1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
Const PS_DOT = 2
Const PS_SOLID = 0
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Declare Function MoveToEx Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, lpPoint As POINTAPI) As Long
Private Declare Function LineTo Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function CreatePen Lib "gdi32" (ByVal nPenStyle As Long, ByVal nWidth As Long, ByVal crColor As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Sub Form_Load()
Me.ScaleMode = vbPixels
End Sub
Private Sub Form_Click()
Dim hRPen As Long, I As Integer
Dim Points As POINTAPI
Me.Cls
For I = 0 To 7
'Définir le trait
hRPen = CreatePen(PS_SOLID, 1 + I, QBColor(I + 8))
'Selectionner le nouveau trait et détruire le précédent
DeleteObject SelectObject(Me.hdc, hRPen)
MoveToEx Me.hdc, 10, 10 + (I * 15), Points
LineTo Me.hdc, 250, 10 + (I * 15)
Next
'Détruire le trait
DeleteObject hRPen
End Sub |