| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 940 人关注过本帖, 1 人收藏
标题:请问用VB6如何绘制着色的三角形
只看楼主 加入收藏
gongjh001
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2011-10-8
结帖率:0
收藏(1)
已结贴  问题点数:0 回复次数:2 
请问用VB6如何绘制着色的三角形
请问用VB6如何绘制着色的三角形,已知三角形三个顶点坐标,绘制一个三角形,三角形内部填充指定颜色。多谢!
搜索更多相关主题的帖子: 如何 三角形 
2011-10-08 10:51
睿翼
Rank: 3Rank: 3
来 自:广东
等 级:论坛游侠
帖 子:40
专家分:175
注 册:2010-12-13
收藏
得分:20 
Private Declare Function ExtFloodFill Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long, ByVal wFillType As Long) As Long

Private Sub Picture1_Click()
With Picture1
.FillColor = vbRed
.FillStyle = 0
.ForeColor = vbBlue
Picture1.Line (Picture1.ScaleLeft, Picture1.ScaleTop)-(Picture1.ScaleLeft + Picture1.ScaleWidth, Picture1.ScaleTop + Picture1.ScaleHeight / 2)
Picture1.Line -(Picture1.ScaleLeft, Picture1.ScaleTop + Picture1.ScaleHeight)
Picture1.Line -(Picture1.ScaleLeft, Picture1.ScaleTop)
End With
Call ExtFloodFill(Picture1.hdc, Picture1.ScaleLeft + 1, Picture1.ScaleTop + 1, vbBlue, 0)
End Sub
2011-10-08 17:43
睿翼
Rank: 3Rank: 3
来 自:广东
等 级:论坛游侠
帖 子:40
专家分:175
注 册:2010-12-13
收藏
得分:0 
Private Type POINTAPI
        x As Long
        y As Long
End Type
Private Declare Function CreatePen Lib "gdi32" (ByVal nPenStyle As Long, ByVal nWidth As Long, ByVal crColor As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
Private Declare Function Polygon Lib "gdi32" (ByVal hdc As Long, lpPoint As POINTAPI, ByVal nCount As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long

Private Sub Form_Click()
Dim pt(2) As POINTAPI
pt(0).x = 200: pt(0).y = 200
pt(1).x = 300: pt(1).y = 300
pt(2).x = 100: pt(2).y = 300

hpen = CreatePen(0, 1, 边框颜色)  '创建画笔
SelectObject Me.hdc, hpen         '使用画笔
hbrush = CreateSolidBrush(填充颜色)  '创建笔刷
SelectObject Me.hdc, hbrush   '使用笔刷
Polygon Me.hdc, pt(0), 3  '绘制并填充多边形
DeleteObject hpen      '删除画笔和笔刷
DeleteObject hbrush
End Sub
2011-10-09 23:21
快速回复:请问用VB6如何绘制着色的三角形
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.041437 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved