event Paint (hDC as Long, left as Long, top as Long, right as Long, bottom as Long)
Fired when the control is painting.

 TypeDescription 
   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. 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


Send comments on this topic.
© 1999-2006 Exontrol Inc, Software. All rights reserved.