Results 1 to 4 of 4

Thread: Graphics

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2001
    Location
    Ireland
    Posts
    33

    Smile

    I have entered values into a Flexgrid - How can i draw a line between 2 points in the Flexgrid???

  2. #2
    Guest
    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

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2001
    Location
    Ireland
    Posts
    33

    Cool graphics

    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
    Thank you!!
    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???





  4. #4

    Thread Starter
    Member
    Join Date
    Jan 2001
    Location
    Ireland
    Posts
    33

    Question Re: graphics

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width