📄 nodef.frm
字号:
VERSION 5.00
Begin VB.Form NodeF
Caption = "请输入节点信息"
ClientHeight = 3945
ClientLeft = 60
ClientTop = 450
ClientWidth = 4560
LinkTopic = "Form2"
ScaleHeight = 3945
ScaleWidth = 4560
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton WanCheng
Caption = "退出"
Height = 375
Left = 2880
TabIndex = 18
Top = 3240
Width = 1335
End
Begin VB.CommandButton Add
Caption = "最后一个"
Height = 375
Index = 4
Left = 3000
TabIndex = 16
Top = 2520
Width = 855
End
Begin VB.CommandButton Add
Caption = "第一个"
Height = 375
Index = 3
Left = 3000
TabIndex = 15
Top = 2040
Width = 855
End
Begin VB.CommandButton Add
Caption = "下翻"
Height = 375
Index = 2
Left = 3000
TabIndex = 14
Top = 1560
Width = 855
End
Begin VB.CommandButton Add
Caption = "上翻"
Height = 375
Index = 1
Left = 3000
TabIndex = 13
Top = 1080
Width = 855
End
Begin VB.TextBox Text4
Height = 375
Left = 1440
TabIndex = 9
Top = 2160
Width = 975
End
Begin VB.TextBox Text3
Height = 375
Left = 1440
TabIndex = 8
Top = 1680
Width = 975
End
Begin VB.CommandButton Delete
Caption = "删除"
Height = 375
Left = 1440
TabIndex = 6
Top = 3240
Width = 1335
End
Begin VB.CommandButton Add
Caption = "新增"
Height = 375
Index = 0
Left = 3000
TabIndex = 5
Top = 600
Width = 855
End
Begin VB.CommandButton QueDing
Caption = "确定"
Height = 375
Left = 120
TabIndex = 4
Top = 3240
Width = 1095
End
Begin VB.TextBox Text2
Height = 375
Left = 1440
TabIndex = 1
Top = 1200
Width = 975
End
Begin VB.TextBox Text1
Height = 375
Left = 1440
TabIndex = 0
Top = 720
Width = 975
End
Begin VB.Label Label7
Caption = "节点信息:"
Height = 255
Left = 480
TabIndex = 17
Top = 240
Width = 1095
End
Begin VB.Label Label6
Alignment = 2 'Center
Caption = "编号"
Height = 255
Left = 360
TabIndex = 12
Top = 2640
Width = 855
End
Begin VB.Label Label5
Alignment = 2 'Center
Caption = "X方向受力"
Height = 255
Left = 240
TabIndex = 11
Top = 1800
Width = 975
End
Begin VB.Label Label4
Alignment = 2 'Center
Caption = "Y方向受力"
Height = 255
Left = 240
TabIndex = 10
Top = 2280
Width = 975
End
Begin VB.Label Label3
Caption = "0/0"
Height = 255
Left = 1440
TabIndex = 7
Top = 2640
Width = 975
End
Begin VB.Label Label2
Alignment = 2 'Center
Caption = "Y坐标"
Height = 255
Left = 720
TabIndex = 3
Top = 1320
Width = 495
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "X坐标"
Height = 255
Left = 720
TabIndex = 2
Top = 720
Width = 495
End
End
Attribute VB_Name = "NodeF"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Private Sub Add_Click(Index As Integer)
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
QueDing.Enabled = True
If Index = 0 Then '新增
Add(0).Enabled = False
NDF = 2
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
NN1 = NN1 + 1
N1 = NN1 * NDF
ReDim Preserve X1(NN1) As Double
ReDim Preserve Y1(NN1) As Double
ReDim Preserve AL1(N1) As Double
i = NN1
Label3.Caption = i & "/" & NN1
IsAddedNode = True
' Add(0).Enabled = False
ElseIf Index = 1 Then '上翻
If i = 0 Then
MsgBox ("error!")
ElseIf i = 1 Then
MsgBox ("已为第1个点!")
Else
i = i - 1
Text1.Text = X1(i)
Text2.Text = Y1(i)
Text3.Text = AL1(2 * i - 1)
Text4.Text = AL1(2 * i)
Label3.Caption = i & "/" & NN1
End If
ElseIf Index = 2 Then '下翻
If i = 0 Then
MsgBox ("error!")
ElseIf i = NN1 Then
MsgBox ("已为最后1个点!")
Else
i = i + 1
Text1.Text = X1(i)
Text2.Text = Y1(i)
Text3.Text = AL1(2 * i - 1)
Text4.Text = AL1(2 * i)
Label3.Caption = i & "/" & NN1
End If
ElseIf Index = 3 Then '第一个
If i = 0 Then
MsgBox ("error!")
Else
i = 1
Text1.Text = X1(1)
Text2.Text = Y1(1)
Text3.Text = AL1(1)
Text4.Text = AL1(2)
Label3.Caption = 1 & "/" & NN1
End If
ElseIf Index = 4 Then '最后一个
If i = 0 Then
MsgBox ("error!")
Else
i = NN1
Text1.Text = X1(i)
Text2.Text = Y1(i)
Text3.Text = AL1(2 * i - 1)
Text4.Text = AL1(2 * i)
Label3.Caption = i & "/" & NN1
End If
End If
HaveReaded = False
End Sub
'删除结点
Private Sub Delete_Click()
If i = 0 Then
MsgBox ("操作错误!")
Exit Sub
End If
If NN1 = 1 Then
X1(i) = 0
Y1(i) = 0
AL1(i) = 0
AL1(i + 1) = 0
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Label3.Caption = 0 & "/" & 0
i = 0
NN1 = NN1 - 1
NLN1 = NLN1 - 1
N1 = NN1 * NDF
Else
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
For h = i + 1 To NN1
X1(h - 1) = X1(h)
Y1(h - 1) = Y1(h)
AL1(2 * (h - 1) - 1) = AL1(2 * h - 1)
AL1(2 * (h - 1)) = AL1(2 * h)
Next h
NN1 = NN1 - 1
N1 = NN1 * NDF
If AL1(NDF * (i - 1) + 1) <> 0 Or AL1(NDF * (i - 1) + 2) <> 0 Then
NLN1 = NLN1 - 1
End If
'删除与之对应的杆件和支座
If IsAddedGanJian = True Then
Dim j As Integer, t As Integer
j = 1
Do While j <= NE1
If NCO1(NNE * (j - 1) + 1) = i Or NCO1(NNE * (j - 1) + 2) = i Then
For t = j To NE1
If t < NE1 Then
NCO1(NNE * (t - 1) + 1) = NCO1(NNE * t + 1)
NCO1(NNE * (t - 1) + 2) = NCO1(NNE * t + 2)
PROP1(t) = PROP1(t + 1)
End If
Next t
NE1 = NE1 - 1
ReDim Preserve NCO1(2 * NE1)
ReDim Preserve PROP1(NE1) As Double
j = j - 1
End If
j = j + 1
Loop
For t = 1 To NE1
If NCO1(NNE * (t - 1) + 1) > i Then NCO1(NNE * (t - 1) + 1) = NCO1(NNE * (t - 1) + 1) - 1
If NCO1(NNE * (t - 1) + 2) > i Then NCO1(NNE * (t - 1) + 2) = NCO1(NNE * (t - 1) + 2) - 1
Next t
End If
If IsAddedBase = True Then
j = 1
Do While j <= NBN1
If IB1(3 * j - 2) = i Then
For t = j To NBN1
If t < NBN1 Then
IB1(3 * t - 2) = IB1(3 * t + 1)
IB1(3 * t - 1) = IB1(3 * t + 2)
IB1(3 * t) = IB1(3 * t + 3)
End If
Next t
NBN1 = NBN1 - 1
ReDim Preserve IB1((NDF + 1) * NBN1) As Integer
j = j - 1
End If
j = j + 1
Loop
For t = 1 To NBN1
If IB1(3 * t - 2) > i Then IB1(3 * t - 2) = IB1(3 * t - 2) - 1
Next t
End If
If i > 1 Then i = i - 1
Text1.Text = X1(i)
Text2.Text = Y1(i)
Text3.Text = AL1(2 * i - 1)
Text4.Text = AL1(2 * i)
Label3.Caption = i & "/" & NN1
End If
If i = 0 Then
IsAddedNode = False
IsAddedGanJian = False
IsAddedBase = False
End If
ReDim Preserve X1(NN1) As Double
ReDim Preserve Y1(NN1) As Double
ReDim Preserve AL1(NN1 * NDF) As Double
HaveReaded = False
If HaveShowGraph = False Then Exit Sub
DrawPicture MainForm.MainPic, vbRed
If EditType <> -1 Then Unload Me
End Sub
Private Sub Form_Load()
If HaveReaded = False Then HaveShowGraph = True
If NN1 = 0 Then IsAddedNode = False
If IsAddedNode = False Then
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Add(1).Enabled = False
Add(2).Enabled = False
Add(3).Enabled = False
Add(4).Enabled = False
QueDing.Enabled = False
Delete.Enabled = False
WanCheng.Enabled = False
ReDim X1(100) As Double
ReDim Y1(100) As Double
ReDim AL1(300) As Double
Label3.Caption = 0 & "/" & 0
HaveShowGraph = True
ElseIf IsAddedNode = True Then
If isCatch = True And tempN <= NN1 Then i = tempN
If i = 0 Then i = NN1
Text1.Text = X1(i)
Text2.Text = Y1(i)
Text3.Text = AL1(2 * i - 1)
Text4.Text = AL1(2 * i)
Label3.Caption = i & "/" & NN1
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
If NN1 = 0 Then
IsAddedNode = False
HaveShowGraph = False
End If
End Sub
Private Sub QueDing_Click()
If i = 0 Then
MsgBox ("操作错误!")
Else
Add(0).Enabled = True
Add(1).Enabled = True
Add(2).Enabled = True
Add(3).Enabled = True
Add(4).Enabled = True
Delete.Enabled = True
QueDing.Enabled = False
WanCheng.Enabled = True
NDF = 2 '分别输入X1,Y1,AL1,NLN1并计算总数
X1(i) = Val(Text1.Text)
Y1(i) = Val(Text2.Text)
AL1(NDF * (i - 1) + 1) = Val(Text3.Text)
AL1(NDF * (i - 1) + 2) = Val(Text4.Text)
If AL1(NDF * (i - 1) + 1) <> 0 Or AL1(NDF * (i - 1) + 2) <> 0 Then
NLN1 = NLN1 + 1
End If
IsAddedNode = True
ReDim Preserve X1(NN1) As Double
ReDim Preserve Y1(NN1) As Double
ReDim Preserve AL1(N1) As Double
ReDim Preserve PROP1(NE1) As Double
ReDim Preserve NCO1(NNE * NE1)
ReDim Preserve IB1((NDF + 1) * NBN1) As Integer
ReDim Preserve REAC1(NN1 * NDF) As Double
HaveReaded = False
If HaveShowGraph = False Then Exit Sub
SetScale MainForm.MainPic, X1(i), Y1(i)
DrawPicture MainForm.MainPic, vbRed
End If
End Sub
Private Sub WanCheng_Click()
Unload NodeF
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -