Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Graphics Help with polygon api

Status
Not open for further replies.

wraygun

Programmer
Joined
Dec 9, 2001
Messages
272
Location
US
Finally making the tranistion to VB.Net. I was wondering if anyone could help me with the following. This is what I use to draw polygons in VB6. How do I adapt it to work in VB.Net?

Code:
'API Declares for polygon drawing
Private Declare Function Polygon Lib "gdi32.dll" (ByVal hdc As Long, lpPoint As POINT_TYPE, ByVal nCount As Long) As Long
Private Declare Function SetPolyFillMode Lib "gdi32" (ByVal hdc As Long, ByVal nPolyFillMode As Long) As Long
Private Declare Function GetPolyFillMode Lib "gdi32" (ByVal hdc As Long) As Long

'For drawing polygons
Dim points(0 To 4) As POINT_TYPE  ' vertices of the polygon
Dim retval As Long  ' return value

'This example is for drawing in a picturebox.


'In Module
Type POINT_TYPE
  X As Long
  Y As Long
End Type


'In Sub
retval = SetPolyFillMode(Picture1.hdc, 1)
points(0).X = gx(Point1) * Multi + ScrCenX: points(0).Y = gy(Point1) * Multi + ScrCenY ' 1st point
points(1).X = gx(Point2) * Multi + ScrCenX: points(1).Y = gy(Point2) * Multi + ScrCenY ' 2nd point
points(2).X = gx(Point3) * Multi + ScrCenX: points(2).Y = gy(Point3) * Multi + ScrCenY ' 3rd point
points(3).X = gx(Point4) * Multi + ScrCenX: points(3).Y = gy(Point4) * Multi + ScrCenY ' 4rd point
retval = Polygon(Picture1.hdc, points(0), 4)
Any help will be appreciated.

Thanks,
Harold


***You can't change your past, but you can change your future***
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top