我想知道,VB画图时用API只能在picture上??能不能在form上画啊???

PrivateDeclareFunctionRectangleLib"gdi32"(ByValhdcAsLong,ByValX1AsLong,ByValY1AsLong,... Private Declare Function Rectangle Lib "gdi32 " (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 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 PolyBezier Lib "gdi32 " (ByVal hdc As Long, lppt As POINTAPI, ByVal cPoints As Long) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Sub Command3_Click()
Dim loc(5) As POINTAPI
'绘制矩形
Rectangle Me.hdc, 0, 0, 12500, 6000

'绘制三角形
loc(0).x = 100: loc(0).y = 80
loc(1).x = 50: loc(1).y = 170
loc(2).x = 150: loc(2).y = 170
Polygon Me.hdc, loc(0), 3

那能帮忙看看吗?
展开
 我来答
匿名用户
2010-07-19
展开全部
当然可以.将Picture1改为Me

补充:
Option Explicit
Private Declare Function Rectangle Lib "gdi32 " (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 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 PolyBezier Lib "gdi32 " (ByVal hdc As Long, lppt As POINTAPI, ByVal cPoints As Long) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Sub Command1_Click()
Dim loc(2) As POINTAPI
'绘制三角形
loc(0).x = 100
loc(0).y = 80
loc(1).x = 50
loc(1).y = 170
loc(2).x = 150
loc(2).y = 170
Polygon Me.hdc, loc(0), 3
End Sub
按LZ的代码,不是可以在窗体绘制一三角形图形!
liuekj
2010-07-19 · TA获得超过163个赞
知道小有建树答主
回答量:235
采纳率:0%
帮助的人:0
展开全部
可以的, 应该是有 .hdc 的就可以画。。。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式