Gets the drawing context of the 2D image layer.
Syntax: |
---|
FWiz.Get2DImageCtx() |
Return Value
Returns a FWiz2DImage object.
Remarks
The 2D image drawing context is only available in the function in response to the OnBuild2DImage event.
Example
See the TO-220 sample code for the complete script.
Copy code | |
---|---|
function OnBuild2DImage()
{
var A = FWiz.GetValue("A");
var J1 = FWiz.GetValue("J1");
var c = FWiz.GetValue("c");
var E = FWiz.GetValue("E");
var F = FWiz.GetValue("F");
var ctx = FWiz.Get2DImageCtx();
var rect = new DlxRect();
var y = J1 + c / 2 - A / 2;
// body
ctx.SetPenStyle(0);
ctx.SetBrushStyle(0);
rect.SetRect(new DlxPoint(0,y), E, A);
ctx.BeginGroup("Body");
ctx.DrawRectangle(rect);
ctx.EndGroup();
// tab
ctx.SetBrushStyle(1);
rect.bottom = rect.top - F;
ctx.BeginGroup("Tab");
ctx.DrawRectangle(rect);
ctx.EndGroup();
}
|