<< Click to Display Table of Contents >> UDODC |
[Professional Edition and above, not available for Java, PHP, Python, Ruby. Not available for .NET, see UDOGraphics]
This property is only accessible while you are processing the event DoUDOPaint() (VCL: OnUDOPaint(), .NET: UDOPaint()). Retrieving this value while not processing the event will return invalid - and therefore useless - data.
It returns the current Device Context VPE is painting on (this maybe the screen or a printer Device Context). Using this Device Context, you can call any Windows GDI function and paint yourself into Device Context. Be careful, do not destroy the Device Context and make sure to free all used system resources. In case of misuse the system may hang or fail to work correctly.
property long VPE.UDODC
read; runtime only
Returns:
the HDC of the UDO that has to be painted
Remarks:
Before VPE fires the UDOPaint - event, it draws the Box object the UDO object is inherited from. Afterwards VPE saves the Device Context with the Windows GDI function SaveDC( ) and creates a clipping rectangle around the object.
After you have finished painting and return control to VPE by returning from your event-handler, VPE will delete the clipping rectangle and restore the Device Context with the Windows GDI function RestoreDC( ).
Example:
Doc.CreateUDO(1, 1, -18, -18, 1);
Creates a UDO with the current properties of the Box-Object and the ID (=lParam) "1"
Processing of the DoUDOPaint() event in Visual Basic:
Make the following declarations in a global module:
Declare Sub MoveToEx Lib "gdi32" (ByVal hDC As Long, ByVal x As Long, ByVal y As Long, ByVal dummy As Long)
Declare Sub LineTo Lib "gdi32" (ByVal hDC As Long, ByVal x As Long, ByVal y As Long)
Create a UDO with:
Private Sub Form_Load()
Doc.OpenDoc
Call Doc.CreateUDO(1, 1, -18, -18, 1)
Call Doc.Preview
End Sub
The event handler itself:
Private Sub Doc_DoUDOPaint()
rem Windows GDI LineTo() draws a line from the current position up to,
rem but not including, the specified point.
rem Therefore we add 1 to each coordinate.
If Doc.UDOlParam = 1 Then
Call MoveToEx(Doc.UDODC, Doc.nUDOLeft, Doc.nUDOTop, 0)
Call LineTo(Doc.UDODC, Doc.nUDORight + 1, Doc.nUDOBottom + 1)
Call MoveToEx(Doc.UDODC, Doc.nUDORight, Doc.nUDOTop, 0)
Call LineTo(Doc.UDODC, Doc.nUDOLeft - 1, Doc.nUDOBottom + 1)
End If
End Sub
The example draws two crossing lines within the UDO.