I have entered values into a Flexgrid - How can i draw a line between 2 points in the Flexgrid???
Printable View
I have entered values into a Flexgrid - How can i draw a line between 2 points in the Flexgrid???
You need a little bit of API. Use the DrawPoint function as shown below.
Code:Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
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 Type POINTAPI
x As Long
y As Long
End Type
Private Sub DrawPoint(fromX, fromY, toX, toY)
Dim hDC_Grid As Long
Dim PT As POINTAPI
hDC_Grid = GetDC(MSFlexGrid1.hwnd)
MoveToEx hDC_Grid, fromX, fromY, PT
LineTo hDC_Grid, toX, toY
End Sub
Private Sub Command1_Click()
'Draw a line from (5,5) to (100,100)
DrawPoint 5, 5, 100, 100
End Sub
Thank you!!Quote:
Originally posted by Megatron
You need a little bit of API. Use the DrawPoint function as shown below.
Code:Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
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 Type POINTAPI
x As Long
y As Long
End Type
Private Sub DrawPoint(fromX, fromY, toX, toY)
Dim hDC_Grid As Long
Dim PT As POINTAPI
hDC_Grid = GetDC(MSFlexGrid1.hwnd)
MoveToEx hDC_Grid, fromX, fromY, PT
LineTo hDC_Grid, toX, toY
End Sub
Private Sub Command1_Click()
'Draw a line from (5,5) to (100,100)
DrawPoint 5, 5, 100, 100
End Sub
Another Question!
Data is entered into the Flexgrid Directly, at runtime. i have assigned the x-coordinates to the variable cat and the y-coodinates to the variable dog- how can i draw a line between these two variables???
Mistake!!!!!
we have entered the variables into the flexgrid and into an array. How do we then plot these variables from the array/flexgrid???
Any help is much appreciated.
coolcat