vb中可通过什么方法画椭圆
答案:2 悬赏:50 手机版
解决时间 2021-04-08 06:25
- 提问者网友:太高姿态
- 2021-04-07 17:57
vb中可通过什么方法画椭圆
最佳答案
- 五星知识达人网友:玩世
- 2021-04-07 18:26
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
全部回答
- 1楼网友:逃夭
- 2021-04-07 19:20
'函数声明
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
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
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯