• 主页

紧急求助，THX

YuanJianYing 2003-01-19 02:36:16

dim X8 as double

X8=Val(Txt(8).text)
...全文
13 点赞 收藏 4

4 条回复

zyl910 2003-01-19
Txt(8)确实存在吗？

YuanJianYing 2003-01-19

Private Sub DrawAllMap_Click()
On Error Resume Next
If Err Then
Err.Clear
If Err Then
MsgBox Err.Description
Exit Sub
End If
End If

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Const Pi = 3.1415926

'定义X,X1,..X8,定义Y,Y1,...Y9,定义R1,...R2,定义a1,a2,...,a4
Dim X As Double
Dim X1 As Double
Dim X2 As Double
Dim X3 As Double
Dim X4 As Double
Dim X5 As Double
Dim X6 As Double
Dim X7 As Double
Dim X8 As Double
Dim M As Double

'以上为定义X轴方向几何尺寸

Dim Y As Double
Dim Y1 As Double
Dim Y2 As Double
Dim Y3 As Double
Dim Y4 As Double
Dim Y5 As Double
Dim Y6 As Double
Dim Y7 As Double
Dim Y8 As Double
Dim Y9 As Double
'以上为定义Y轴方向几何尺寸

Dim R1 As Double
Dim R2 As Double
'以上为定义半径尺寸

Dim a1 As Double
Dim a2 As Double
Dim a3 As Double
Dim a4 As Double

X = Val(TxtX(0).Text)
X1 = Val(TxtX(1).Text)
X2 = Val(TxtX(2).Text)
X3 = Val(TxtX(3).Text)
X4 = Val(TxtX(4).Text)
X5 = Val(TxtX(5).Text)
X6 = Val(TxtX(6).Text)
X7 = Val(TxtX(7).Text)
X8 = Val(TxtX(8).Text)
M = Val(TxtX(9).Text)

Y = Val(TxtY(0).Text)
Y1 = Val(TxtY(1).Text)
Y2 = Val(TxtY(2).Text)
Y3 = Val(TxtY(3).Text)
Y4 = Val(TxtY(4).Text)
Y5 = Val(TxtY(5).Text)
Y6 = Val(TxtY(6).Text)
Y7 = Val(TxtY(7).Text)
Y8 = Val(TxtY(8).Text)
Y9 = Val(TxtY(9).Text)

R1 = Val(TxtX(10).Text)
R2 = Val(TxtX(11).Text)

a1 = Val(Txt(12).Text)
a2 = Val(Txt(13).Text)
a3 = Val(Txt(14).Text)
a4 = Val(Txt(15).Text)

'''''''''''''''''''''''
'几何参数尺寸定义完毕
'''''''''''''''''''''''

Dim IP1 As PD '定义俯视图的绘图基点(InsertPoint=IP
Dim IP2 As PD '定义主视图的绘图基点
IP1.X = X
IP1.Y = Y
IP2.X = X
IP2.Y = Y + Y1 / 2 + Y2 + Y3 + 30
'IP1,IP2为俯视图和主视图的绘图基点

Dim P1 As PD
Dim P2 As PD
P1.X = IP1.X - X1 / 2
P1.Y = IP1.Y + Y1 / 2
P2.X = IP1.X + X1 / 2
P2.Y = IP1.Y + Y1 / 2
Dim P3 As PD
Dim P4 As PD
P3.X = IP1.X - X1 / 2
P3.Y = IP1.Y + Y1 / 2 + Y2
P4.X = IP1.X + X1 / 2
P4.Y = IP1.Y + Y1 / 2 + Y2
Dim P5 As PD
Dim P6 As PD
P5.X = IP1.X - X2 / 2
P5.Y = IP1.Y + Y1 / 2 + Y2
P6.X = IP1.X + X2 / 2
P6.Y = P5.Y
Dim P7 As PD
Dim P8 As PD
P7.X = P5.X
P7.Y = P5.Y + Y3
P8.X = P6.X
P8.Y = P7.Y

'以下画直线12，34，13，24，78，57，68
DrawLine P1, P2
DrawLine P3, P4
DrawLine P1, P3
DrawLine P2, P4
DrawLine P7, P8
DrawLine P5, P7
DrawLine P6, P8

Dim P9 As PD
Dim P34 As PD

Dim P10 As PD
Dim P33 As PD

Dim P11 As PD
Dim P32 As PD

'以下画两个圆弧

P9.X = P1.X - ((Y1 / 2 - Y4) * Cos(a1) - (R1 / Cos(a1) + (Y1 / 2 - Y4 - R1) * Tan(a1) + X1 / 2) - (Y1 / 2 - Y4) * Tan(a1) - X1 / 2) * Sin(a1)
P9.Y = P1.Y - ((Y1 / 2 - Y4) * Cos(a1) - (R1 / Cos(a1) + (Y1 / 2 - Y4 - R1) * Tan(a1) + X1 / 2) - (Y1 / 2 - Y4) * Tan(a1) - X1 / 2) * Cos(a1)
P34.X = P2.X + ((Y1 / 2 - Y4) * Cos(a1) - (R1 / Cos(a1) + (Y1 / 2 - Y4 - R1) * Tan(a1) + X1 / 2) - (Y1 / 2 - Y4) * Tan(a1) - X1 / 2) * Sin(a1)
P34.Y = P9.Y

P10.X = IP1.X - (R1 / Cos(a1) + (Y1 / 2 - Y4 - R1) * Tan(a1) + X1 / 2)
P10.Y = IP1.X + Y4 + R1
P33.X = IP1.X + (R1 / Cos(a1) + (Y1 / 2 - Y4 - R1) * Tan(a1) + X1 / 2)
P33.Y = P10.Y

P11.X = IP1.X - P10.X
P11.Y = IP1.Y + Y4
P32.X = P33.X
P32.Y = P11.Y

DrawArc P10, R1, 3 * Pi / 2, (2 * Pi - a1)
DrawArc P33, R1, (Pi + a1), 3 * Pi / 2

DrawLine P1, P9
DrawLine P2, P34

liushanyu 2003-01-19
dim X8 as double

X8=Val(TxtX(8).text)

nik_Amis 2003-01-19
TxtX 一共做了15个

X8=Val(Txt(8).text)
^^^

VB基础类

7453

VB 基础类