我想知道,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
那能帮忙看看吗? 展开
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的代码,不是可以在窗体绘制一三角形图形!
补充:
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的代码,不是可以在窗体绘制一三角形图形!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询