Type | Description | |||
hDC as Long | A long expression that indicates the handle of the drawing context. Each drawing API uses the handle to device context. | |||
left as Long | A long expression that indicates the left margin. | |||
top as Long | A long expression that indicates the top margin. | |||
right as Long | A long expression that indicates the right margin. | |||
bottom as Long | A long expression that indicates the bottom margin. |
The Paint event is called when the control paints its content. The Paint event provides owner draw support for the control. The /NET assembly provides the Paint event with two parameters of Graphics and Rectangle types.
Syntax for Paint event, /NET version, on:
private void Paint(object sender,int hDC,int left,int top,int right,int bottom) { } Private Sub Paint(ByVal sender As System.Object,ByVal hDC As Integer,ByVal left As Integer,ByVal top As Integer,ByVal right As Integer,ByVal bottom As Integer) Handles Paint End Sub |
private void Paint(object sender, AxEXDIALOGLib._IDialogEvents_PaintEvent e) { } void OnPaint(long hDC,long left,long top,long right,long bottom) { } void __fastcall Paint(TObject *Sender,long hDC,long left,long top,long right,long bottom) { } procedure Paint(ASender: TObject; hDC : Integer;left : Integer;top : Integer;right : Integer;bottom : Integer); begin end; procedure Paint(sender: System.Object; e: AxEXDIALOGLib._IDialogEvents_PaintEvent); begin end; begin event Paint(long hDC,long left,long top,long right,long bottom) end event Paint Private Sub Paint(ByVal sender As System.Object, ByVal e As AxEXDIALOGLib._IDialogEvents_PaintEvent) Handles Paint End Sub Private Sub Paint(ByVal hDC As Long,ByVal left As Long,ByVal top As Long,ByVal right As Long,ByVal bottom As Long) End Sub Private Sub Paint(ByVal hDC As Long,ByVal left As Long,ByVal top As Long,ByVal right As Long,ByVal bottom As Long) End Sub LPARAMETERS hDC,left,top,right,bottom PROCEDURE OnPaint(oDialog,hDC,left,top,right,bottom) RETURN |
<SCRIPT EVENT="Paint(hDC,left,top,right,bottom)" LANGUAGE="JScript"> </SCRIPT> <SCRIPT LANGUAGE="VBScript"> Function Paint(hDC,left,top,right,bottom) End Function </SCRIPT> Procedure OnComPaint Integer llhDC Integer llleft Integer lltop Integer llright Integer llbottom Forward Send OnComPaint llhDC llleft lltop llright llbottom End_Procedure METHOD OCX_Paint(hDC,left,top,right,bottom) CLASS MainDialog RETURN NIL void onEvent_Paint(int _hDC,int _left,int _top,int _right,int _bottom) { } function Paint as v (hDC as N,left as N,top as N,right as N,bottom as N) end function function nativeObject_Paint(hDC,left,top,right,bottom) return |
For instance, the following sample draw a text:
Option Explicit
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function DrawFrameControl Lib "user32" (ByVal hDC As Long, lpRect As RECT, ByVal un1 As Long, ByVal un2 As Long) As Long
Private Sub Dialog1_Paint(ByVal hDC As Long, ByVal Left As Long, ByVal Top As Long, ByVal Right As Long, ByVal Bottom As Long)
Dim rt As RECT
rt.Left = Left
rt.Right = Right
rt.Top = Top
rt.Bottom = Bottom
DrawFrameControl hDC, rt, 0, 0
End Sub