我在做深沟球轴承参数化设计时,编写一个程序,程序没有出错,可是图形没有显示出来,请各位高手帮忙看看。非常感谢! 关于参数化设计说明:只需要输入一些参量,就可以显示相应的图形。在这里,是要输入轴承中心坐标x、轴承中心坐标y、轴承内径、轴承外径和轴承宽度。单击显示图形按钮,应该可以在picturebox中显示图形,可是没有显示。程序如下: Const Pi = 3.1415926 Dim x(20) As Single Dim y(20) As Single Dim x0 As Single Dim y0 As Single Private Sub Command1_Click() End End Sub
Private Sub Command2_Click() Picture1.Cls DrawWidth = 2 x0 = Val(Form1.Text1.Text) y0 = Val(Form1.Text2.Text) nj = Val(Form1.Text3.Text) wj = Val(Form1.Text4.Text) bb = Val(Form1.Text5.Text) a = (wj - nj) / 2 x(1) = x0 - bb / 2: y(1) = y0 + nj / 2 + a / 2 - a / 3 * Cos(Pi / 3) x(2) = x0 + a / 3 * Sin(Pi / 3): y(2) = y(1) x(3) = x0 + a / 3 * Sin(Pi / 3): y(3) = y(1) x(4) = x0 + bb / 2: y(4) = y(1) x(4) = x(1): y(5) = y0 + nj / 2 + a / 2 + a / 3 * Cos(Pi / 3) x(6) = x(2): y(6) = y(5) x(7) = x(3): y(7) = y(5) x(8) = x(4): y(8) = y(5) x(9) = x(1): y(9) = y0 - nj / 2 - a / 2 + a / 3 * Cos(Pi / 3) x(10) = x(2): y(10) = y(9) x(11) = x(3): y(11) = y(9) x(12) = x(4): y(12) = y(9) x(13) = x(1): y(13) = y0 - nj / 2 - a / 2 - a / 3 * Cos(Pi / 3) x(14) = x(2): y(14) = y(13) x(15) = x(3): y(15) = y(13) x(16) = x(4): y(16) = y(13) FillStyle = 4 Picture1.Line (x0 - bb / 2, y0 - wj / 2)-(x(16), y(16)), , B Picture1.Line (x(5), y(5))-(x0 + bb / 2, y0 - wj / 2), , B FillStyle = 5 Picture1.Line (x(9), y(9))-(x0 + bb / 2, y0 - nj / 2), , B Picture1.Line (x0 - bb / 2, y0 + nj / 2)-(x(4), y(4)), , B Picture1.Line (x(5), y(5))-(x(13), y(13)) Picture1.Line (x(8), y(8))-(x(16), y(16)) FillStyle = 0 FillColor = BackColor Picture1.Circle (x0, y0 + nj / 2 + a / 2), a / 3 Picture1.Circle (x0, y0 - nj / 2 - a / 2), a / 3 DrawWidth = 1 DrawStyle = 3 Picture1.Line (x0 - bb / 2 - 5, y0)-(x0 + bb / 2 + 5, y0) Picture1.Line (x0, y0 + wj / 2)-(x0, y0 + nj / 2) Picture1.Line (x0, y0 - wj / 2)-(x0, y0 - nj / 2) Picture1.Line (x0 - bb / 2 + 2, y0 + nj / 2 + a / 2)-(x0 + bb / 2 - 2, y0 + nj / 2 + a / 2) Picture1.Line (x0 - bb / 2 + 2, y0 - nj / 2 - a / 2)-(x0 + bb / 2 - 2, y0 - nj / 2 - a / 2) Picture1.CurrentX = x3 Picture1.CurrentY = y3 + 150 End Sub
Private Sub Form_Load() Me.Left = (Screen.Width - Me.Width) / 2 Me.Top = (Screen.Height - Me.Height) / 2 End Sub