Results 1 to 3 of 3

Thread: Doh?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Posts
    123
    Ok, just a quicky Q... can anyone show me an example of how you can plot a line in a picture box? Or better yet, how bout a quadratic?

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Lightbulb Use the PolyLine API function OR Object.Line function

    Code:
    Option Explicit
    Private Type POINTAPI
            X As Long
            Y As Long
    End Type
    Private Declare Function Polyline Lib "gdi32" (ByVal hdc As Long, lpPoint As POINTAPI, ByVal nCount As Long) As Long
    Dim xPt(0 To 3) As POINTAPI
    
    Private Sub Command1_Click()
        Picture1.Line (500, 500)-(1000, 1000), vbRed
    End Sub
    'OR this as well...
    Private Sub Picture1_Paint()
        xPt(0).X = 10: xPt(0).Y = 10
        xPt(1).X = 10: xPt(1).Y = 100
        xPt(2).X = 10: xPt(2).Y = 50
        xPt(3).X = 50: xPt(3).Y = 10
        Polyline Picture1.hdc, xPt(0), 6
    End Sub

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Posts
    123
    Thanks!

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