Field AfterDrawInView
- Namespace
- vdWebLibrary
- Assembly
- JsPropertiesExtractor.dll
Represents a user define function of type AfterDrawInViewDelegate that will be called just after all document entities drawn.
public AfterDrawInViewDelegate AfterDrawInView
Returns
- AfterDrawInViewDelegate
- Represents a user define function of type that will be called just after all document entities drawn.
Examples
On the following example we create a new solid colored rectangle with the width and the height of the canvas and on the bottom right corner
of the screen we create and display a text with text string "vdraw screen". Also if we call the printToImageData, we display and print a text on the bottom right
corner of the selected print window with the text string "vdraw printer window". And in the last case again in the print operation we create and and print another
text on the bottom right corner of the printer paper with the text string "vdraw printer paper".
NOTE both of the rectangle and the texts are not be added in the document entities and not be saved if we save the document.
<pre><code class="lang-csharp"> vdcanvas.AfterDrawInView = AfterDrawInView;// set the event in the initialize page load
function AfterDrawInView(e) {
var oldcolor = e.sender.GetActivePenColor();
var r = e.sender.AddRect2([e.viewrect.left , e.viewrect.bottom , 0], (e.viewrect.right - e.viewrect.left), (e.viewrect.top - e.viewrect.bottom), 0, false, {});
r.HatchProperties = vdcanvas.createNewHatchProperties('solid', null, vdConst.colorFromString("255,0,0,90"), 1.0, 0.0);
e.sender.DrawEntity(r, e.render);
var textstring = "vdraw ";
switch (e.display) {
case 0:
textstring += "screen ";
e.sender.SetActivePenColor(vdConst.colorFromString("255,0,0,255"));
break;
case 2:
textstring += "printer window ";
e.sender.SetActivePenColor(vdConst.colorFromString("0,255,0,255"));
break;
case 4:
textstring += "printer paper ";
e.sender.SetActivePenColor(vdConst.colorFromString("0,0,255,255"));
break;
}
vdcanvas.SetActiveTextStyle(vdcanvas.FindTextStyle('standard'));
var t = e.sender.AddText(textstring, e.pixelsize * 20, [e.viewrect.right, e.viewrect.bottom, 0], vdConst.VdConstHorJust_VdTextHorRight, vdConst.VdConstVerJust_VdTextVerBottom, 0, false, {});
t.BackGroundMask = true;
t.BackGroundMaskColor = vdConst.colorFromString("0,0,255,100");
e.sender.DrawEntity(t, e.render);
e.sender.SetActivePenColor(oldcolor);
}</code></pre>