Article | 41023920 |
Type | HowTo |
Product | Engine |
Version | 5.0.1.1036 |
Date Added | 4/8/2005 |
Submitted by | Indira Restrepo |
Keywords |
You can add a text through DrawAfter Event with the following code.
The text height (in millimeters) can be accesed from the parameter "height"
Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long
Private Const LOGPIXELSY = 90 ' Logical pixels/inch in Y
Private Sub vdraw_DrawAfter(ByVal Render As VDProLib5.vdRender)
Dim xx As Double
Dim yy As Double
Dim size As Double
Dim height As Double ' This is the height in mm as it will be displayed in the paper
height = 20#
If Render.PrinterMode = 2 Or Render.PrinterMode = 4 Then
If Render.PrinterMode = 2 Then
size = height * Render.height / (vdraw.ActiveDocument.Printer.ActivePaperHeight * 0.1)
Else
size = height * GetDeviceCaps(Render.hdc, LOGPIXELSY) / 25.4
End If
Render.Select_Pen 0, 7, 0
Render.PixelToView Render.Left + Render.Width / 2#, Render.Top + Render.height, xx, yy
Render.Drawtext "Hellooooo", xx, yy, 0, vdraw.ActiveDocument.TextStyles.FindName("STANDARD"), size, 0#, VdTextHorCenter, VdTextVerBottom
End If
End Sub