请给出Polygon,Polyline,POINTAPI的详细用法!!!

ton2008 2003-11-06 12:09:16
如题!!!
...全文
226 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
ton2008 2003-11-06
  • 打赏
  • 举报
回复
这是六点构成的多边形吗?还是什么意思呀,能给解讲一下吗?
我想要把这多边形的顶点保存起来,而且我要画自交多边形,
然后把它填充了,一次填满。例如8就是自交的,然后填充后就是一片纯色!!
lihonggen0 2003-11-06
  • 打赏
  • 举报
回复
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 Pts(0 To 6) As POINTAPI
Private Sub Form_Paint()


Pts(0).X = 10: Pts(0).Y = 10
Pts(1).X = 10: Pts(1).Y = 100
Pts(2).X = 10: Pts(2).Y = 50
Pts(3).X = 50: Pts(3).Y = 10
Pts(4).X = 10: Pts(4).Y = 50
Pts(5).X = 50: Pts(5).Y = 100
Polyline Me.hdc, Pts(0), 6
Pts(0).X = 60: Pts(0).Y = 100
Pts(1).X = 60: Pts(1).Y = 10
Pts(2).X = 100: Pts(2).Y = 10
Pts(3).X = 100: Pts(3).Y = 50
Pts(4).X = 60: Pts(4).Y = 50
Polyline Me.hdc, Pts(0), 5
Pts(0).X = 110: Pts(0).Y = 10
Pts(1).X = 150: Pts(1).Y = 10
Pts(2).X = 160: Pts(2).Y = 20
Pts(3).X = 160: Pts(3).Y = 90
Pts(4).X = 150: Pts(4).Y = 100
Pts(5).X = 110: Pts(5).Y = 100
Pts(6).X = 110: Pts(6).Y = 10
Polyline Me.hdc, Pts(0), 7
End Sub

lihonggen0 2003-11-06
  • 打赏
  • 举报
回复
Private Type COORD
x As Long
y As Long
End Type
Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As Any, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long
Private Declare Function Polygon Lib "gdi32" (ByVal hdc As Long, lpPoint As Any, ByVal nCount As Long) As Long
Private Declare Function FillRgn Lib "gdi32" (ByVal hdc As Long, ByVal hRgn As Long, ByVal hBrush As Long) As Long
Private Declare Function GetStockObject Lib "gdi32" (ByVal nIndex As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Const ALTERNATE = 1 ' ALTERNATE and WINDING are
Const WINDING = 2 ' constants for FillMode.
Const BLACKBRUSH = 4 ' Constant for brush type.
Private Sub Form_Paint()

Dim poly(1 To 3) As COORD, NumCoords As Long, hBrush As Long, hRgn As Long
Me.Cls
' Number of vertices in polygon.
NumCoords = 3
' Set scalemode to pixels to set up points of triangle.
Me.ScaleMode = vbPixels
' Assign values to points.
poly(1).x = Form1.ScaleWidth / 2
poly(1).y = Form1.ScaleHeight / 2
poly(2).x = Form1.ScaleWidth / 4
poly(2).y = 3 * Form1.ScaleHeight / 4
poly(3).x = 3 * Form1.ScaleWidth / 4
poly(3).y = 3 * Form1.ScaleHeight / 4
' Polygon function creates unfilled polygon on screen.
' Remark FillRgn statement to see results.
Polygon Me.hdc, poly(1), NumCoords
' Gets stock black brush.
hBrush = GetStockObject(BLACKBRUSH)
' Creates region to fill with color.
hRgn = CreatePolygonRgn(poly(1), NumCoords, ALTERNATE)
' If the creation of the region was successful then color.
If hRgn Then FillRgn Me.hdc, hRgn, hBrush
DeleteObject hRgn
End Sub
Private Sub Form_Resize()
Form_Paint
End Sub
射天狼 2003-11-06
  • 打赏
  • 举报
回复
楼上大侠强~~
saucer 2003-11-06
  • 打赏
  • 举报
回复
see

http://www.mentalis.org/apilist/p.shtml
taosihai1only 2003-11-06
  • 打赏
  • 举报
回复
如上

7,789

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧