How to draw Straight
Posted on January 5, 2009
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 | 'Graphics - How to draw Straight Option Explicit 'Set AutoRedraw property of Form to True. Public Type POINTAPI x As Long y As Long End Type Declare Function Polyline Lib "gdi32" (ByVal hdc As Long, lpPoint As POINTAPI, ByVal nCount As Long) As Long Private Sub Form_Load() Dim Points() As POINTAPI Dim NumPoints As Integer, I As Integer NumPoints = 4 ReDim Points(1 To 4) Points(1).x = 110 Points(1).y = 20 Points(2).x = 130 Points(2).y = 170 Points(3).x = 30 Points(3).y = 70 Points(4).x = 110 Points(4).y = 20 If Polyline(Me.hdc, Points(1), NumPoints) = 0 Then Exit Sub Me.Refresh End Sub |