vb 斜椭圆

来源:百度知道 编辑:UC知道 时间:2024/06/06 08:39:04
vb 斜椭圆 及椭圆的长短轴 不在X y 轴上
怎样画??

VB 画椭圆

'x 中心横坐标, y 中心纵坐标, a 长轴, b 短轴, c 倾斜角度(角度值), Color 颜色
Sub drawellipsoid(ByVal x As Single, ByVal y As Single, ByVal a As Single, ByVal b As Single, ByVal c As Single, Byval Color As Long)
Dim t As Double
Dim tempx As Single
Dim tempy As Single
Dim x1 As Single
Dim y1 As Single

c = -Atn(1) / 45 * c
For t = -3.1415926535 To 3.1415926535 Step 0.003
tempx = Cos(t) * a
tempy = Sin(t) * b
x1 = x + tempx * Cos(c) - tempy * Sin(c)
y1 = y + tempx * Sin(c) + tempy * Cos(c)
Me.PSet (x1, y1), 255
Next t

End Sub

Private Sub Command1_Click()
drawellipsoid 300, 200, 150, 80, 18, 255

End Sub

Private Sub Command1_Click()
Dim P As Single, x As Single, y As Single
Dim i As Single, a As Single, b As Single
'建立坐标系统
Me.ScaleMode = 3
x = 10: y = x * Me.ScaleHeight / Me.ScaleWidth
Me.Scale (-x, -y