![]() | Type | Description | ||
| Part as DrawPartEnum | A Part being painted. | |||
| hDC as Long | A long expression that specifies the handle of the device context where you can perform your own draw. | |||
| X as Long | (by reference) A long expression that specifies the left coordinate of the rectangle where the paint should occur. You can change the X parameter during the handler, to define the new left coordinate for the default painting. | |||
| Y as Long | (by reference) A long expression that specifies the top coordinate of the rectangle where the paint should occur. You can change the Y parameter during the handler, to define the new top coordinate for the default painting. | |||
| Width as Long | (by reference) A long expression that specifies the width of the rectangle where the paint should occur. You can change the Width parameter during the handler, to define the new width for the default painting. | |||
| Height as Long | (by reference) A long expression that specifies the height of the rectangle where the paint should occur. You can change the Height parameter during the handler, to define the new width for the default painting. | |||
| Cancel as Boolean | (by reference) A Boolean expression that specifies whether the default painting is canceled or not |
The following VB sample changes the Y and the Height parameters, and paints the "Histogram" text inside the histogram as shown bellow in the screen shot:
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Const DT_SINGLELINE = &H20
Private Const DT_CENTER = &H1
Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
Private Sub G2antt1_BeforeDrawPart(ByVal Part As EXG2ANTTLibCtl.DrawPartEnum, ByVal hdc As Long, X As Long, Y As Long, Width As Long, Height As Long, Cancel As Boolean)
If (Part = exDrawLeftHistogram) Or (Part = exDrawRightHistogram) Then
Dim h As Long
h = 16
If ((Part = exDrawRightHistogram)) Then
Dim r As RECT
r.Left = X + 2
r.Right = r.Left + Width - 4
r.Top = Y + 1
r.Bottom = r.Top + h - 2
DrawText hdc, "Histogram", 9, r, DT_SINGLELINE + DT_CENTER
End If
Y = Y + h
Height = Height - h
End If
End Sub
