Results 1 to 3 of 3

Thread: Drawing Lines

  1. #1
    Guest

    Talking

    What code can i use to draw a line from one point to another. All points would be connected therefore giving us one shape conected to another shape ect... The points would be located in a text file.

    ie. 12,34
    23,45
    34,56
    23,23
    34,-2

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Line -(x,y) 'will continue drawing from a point to next
    currentx=x: currenty=y 'will move to the startpoint to draw from.
    Open in input and input all the values into an array.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516

    Or...

    If what you want one polygon you could use the polygon API:
    Code:
    Public Declare Function Polygon Lib "gdi32.dll" (ByVal hdc As Long, lpPoint As POINT_TYPE, ByVal nCount As Long) As Long
    
    Type POINT_TYPE
      x As Long
      y As Long
    End Type
    
    Dim points(0 To 3) As POINT_TYPE 
    Dim retval As Long
    
    ' Load the coordinates of the diamond into the array.
    points(0).x = 200: points(0).y = 100  ' 1st point (200,100)
    points(1).x = 250: points(1).y = 150  ' 2nd point (250,150)
    points(2).x = 200: points(2).y = 200  ' 3rd point (200,200)
    points(3).x = 150: points(3).y = 150  ' 4th point (150,150)
    
    ' Draw the diamond using Form1's default pen and brush
    retval = Polygon(Form1.hDC, points(0), 4) 'Points(0) is the start of
    'the array and there are 4 points in the array
    If retval = 0 then Debug.Print "Error drawing polygon"

    And then use the Split() function to turn a text file into an array of numbers.
    You could then use the info from this array to fill the .x and .y of all the points.
    Courgettes.

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