vb中可通过什么方法画椭圆
2个回答
展开全部
obj.Circle (x, y), r, c, s, e, k
obj 是要画椭圆的对象,可以是窗体或图片框,如Form1或Picture1
(x, y) 圆心坐标
r 半径
c 边线颜色
s和e 是起始角和终止角,画弧线或扇形的时候才需要用到,这里可以留空
k 是椭圆的高宽比例
下面的代码将在当前窗口的中心画一个红色的、宽是高2倍的椭圆:
Me.Circle (Me.ScaleWidth \ 2, Me.ScaleHeight \ 2), Me.ScaleHeight \ 3, vbRed, , , 0.5
obj 是要画椭圆的对象,可以是窗体或图片框,如Form1或Picture1
(x, y) 圆心坐标
r 半径
c 边线颜色
s和e 是起始角和终止角,画弧线或扇形的时候才需要用到,这里可以留空
k 是椭圆的高宽比例
下面的代码将在当前窗口的中心画一个红色的、宽是高2倍的椭圆:
Me.Circle (Me.ScaleWidth \ 2, Me.ScaleHeight \ 2), Me.ScaleHeight \ 3, vbRed, , , 0.5
展开全部
'函数声明
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, _
ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, _
ByVal hRgn As Long, ByVal bRedraw As Long) As Long
Private Sub Form_Load()
Dim a, b As Long
Dim w, h As Long
w = Form1.Width / Screen.TwipsPerPixelX
h = Form1.Height / Screen.TwipsPerPixelY
a = CreateEllipticRgn(0, 0, w, h)
b = SetWindowRgn(Me.hWnd, a, True) '设置椭圆形窗体
End Sub
Private Sub Form_Activate()
Picture1(0).Visible = True
End Sub
Private Sub Label1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1(0).Visible = False
Picture1(1).Visible = False
Picture1(2).Visible = False
Picture1(3).Visible = False
Select Case Index
Case Is = 0
Picture1(0).Visible = True '鼠标所在位置图形突起
Case Is = 1
Picture1(1).Visible = True '鼠标所在位置图形突起
Case Is = 2
Picture1(2).Visible = True '鼠标所在位置图形突起
Case Is = 3
Picture1(3).Visible = True '鼠标所在位置图形突起
End Select
End Sub
Private Sub Picture1_Click(Index As Integer)
End
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询