Polygon API Call... 
Author Message
 Polygon API Call...


I have been playing around with the Polyline API call in a VB4.0 app.  I
first tested with the LineTo api call, and get the desired results.  If
I try to replace multiple LineTo calls with with a Polyline api call,
using the same co-ordinates (or even testing with other co-ords) I get
nothing like what I would expect.

Does anybody have experience with using the Polygon, Polyline, or
PolyPolygon API calls from VB40?

Any help would be appreciated.

Bret Stateham

PS - Here is the code I have used.  Create a form frmMain, drop a
PictureBox on it named picPaper.  Then try calling the PaintLineTo and
PointPolyline procedures.

Option Explicit

        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

Declare Function LineTo Lib "gdi32" (ByVal hdc As Long, ByVal x As Long,
ByVal y As Long) As Long

Declare Function MoveToEx Lib "gdi32" (ByVal hdc As Long, ByVal x As
Long, ByVal y As Long, lpPoint As POINTAPI) As Long

Sub PaintLineTo()

  Dim lResult As Long
  Dim pStart As POINTAPI
  Dim lOldX As Long
  Dim lOldY As Long
  Dim pOld As POINTAPI

  frmMain!picPaper.CurrentX = 100
  frmMain!picPaper.CurrentY = 100

  pStart.x = 100
  pStart.y = 100

  lResult = MoveToEx(frmMain!picPaper.hdc, pStart.x, pStart.y, pOld)
  lResult = LineTo(frmMain!picPaper.hdc, 250, 250)
  lResult = LineTo(frmMain!picPaper.hdc, 500, 250)
  lResult = LineTo(frmMain!picPaper.hdc, 500, 100)
  lResult = LineTo(frmMain!picPaper.hdc, 250, 100)
  lResult = LineTo(frmMain!picPaper.hdc, pStart.x, pStart.y)


End Sub

Sub PaintPolyline()

  Dim aPoints(6) As POINTAPI
  Dim lResult As Long

  aPoints(0).x = 100
  aPoints(0).y = 100
  aPoints(1).x = 250
  aPoints(1).y = 250
  aPoints(2).x = 500
  aPoints(2).y = 250
  aPoints(3).x = 500
  aPoints(3).y = 100
  aPoints(4).x = 250
  aPoints(4).y = 100
  aPoints(5).x = 100
  aPoints(5).y = 100

  lResult = Polyline(frmMain!picPaper.hdc, aPoints, 6)

End Sub

Fri, 21 Aug 1998 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. picturebox.scale command with Polyline or Polygon API Call

2. Polygon API calls.....

3. VB5 Polygon API calling ?

4. polygon - polygon intersection

5. How to call "Polygon"-func??

6. Lines, Polygons and PolyBezier(?) with the API

7. help...create polygon region API

8. HELP: API Polygon Functions

9. Problems with Polygon API Function

10. Someone please help with Polygon API??

11. Polygon API

12. Draw Polygon with eVB API invocation failed


Powered by phpBB® Forum Software