📄 graphcan.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form GraphCan
AutoRedraw = -1 'True
BackColor = &H00000000&
Caption = "图像显示"
ClientHeight = 6615
ClientLeft = 165
ClientTop = 570
ClientWidth = 10230
BeginProperty Font
Name = "宋体"
Size = 7.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 6615
ScaleWidth = 10230
Begin MSComDlg.CommonDialog CoD1
Left = 7080
Top = 0
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.Menu save
Caption = "保存"
End
Begin VB.Menu Zhushia
Caption = "注释显示"
Begin VB.Menu NodeNum
Caption = "节点编号"
End
Begin VB.Menu GJnum
Caption = "杆件编号"
End
Begin VB.Menu Force
Caption = "轴力大小"
End
End
Begin VB.Menu mnuGOper
Caption = "图像操作"
Begin VB.Menu mnuZoom
Caption = "全图"
Index = 0
End
Begin VB.Menu mnuZoom
Caption = "放大"
Index = 1
End
Begin VB.Menu mnuZoom
Caption = "缩小"
Index = 2
End
Begin VB.Menu mnuZoom
Caption = "移动"
Index = 3
End
Begin VB.Menu mnuZoom
Caption = "开窗放大"
Index = 4
End
End
Begin VB.Menu times
Caption = "放大倍数"
Visible = 0 'False
End
End
Attribute VB_Name = "GraphCan"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'是否显示轴力大小
Private Sub Force_Click()
If isCalculate = False Then
MsgBox "请先进行计算!"
Exit Sub
End If
mStructor.DrawForceMag Me, vbYellow
End Sub
Private Sub Form_Load()
Select Case GraphType
Case 2, 5
times.Visible = True
Case 1, 3, 4
times.Visible = False
End Select
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
DrawMode = vbXorPen
DrawWidth = 1
mx0 = X: my0 = Y
If Button = 1 Then ' 鼠标左键
If GraphOperType = 1 Then '放大
ElseIf GraphOperType = 2 Then '缩小
ElseIf GraphOperType = 3 Then '移动
ElseIf GraphOperType = 4 Then '开窗放大
Me.Line (mx0, my0)-(X, Y), vbCyan, B
mx = X
my = Y
End If
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
SetFocus
DrawWidth = 1
DrawMode = vbXorPen
If Button = 1 Then '鼠标左键 => 开窗
If GraphOperType = 1 Then '放大
' ElseIf GraphOperType = 2 Then '缩小
' ElseIf GraphOperType = 3 Then '移动
ElseIf GraphOperType = 4 Then '开窗放大
Me.Line (mx0, my0)-(mx, my), vbCyan, B
Me.Line (mx0, my0)-(X, Y), vbCyan, B
mx = X
my = Y
End If
Exit Sub
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
DrawMode = vbXorPen
DrawWidth = 1
mx = X: my = Y
If Button = 1 Then
If GraphOperType = 1 Then '放大
xWmin = mx - (mx - xWmin) * 0.8
xWmax = mx + (xWmax - mx) * 0.8
yWmin = my - (my - yWmin) * 0.8
yWmax = my + (yWmax - my) * 0.8
ElseIf GraphOperType = 2 Then '缩小
xWmin = mx - (mx - xWmin) * 1.2
xWmax = mx + (xWmax - mx) * 1.2
yWmin = my - (my - yWmin) * 1.2
yWmax = my + (yWmax - my) * 1.2
ElseIf GraphOperType = 3 Then '移动
If Abs(mx - mx0) < Unit Or Abs(my - my0) < Unit Then Exit Sub
xWmin = xWmin + mx0 - mx
xWmax = xWmax + mx0 - mx
yWmin = yWmin + my0 - my
yWmax = yWmax + my0 - my
ElseIf GraphOperType = 4 Then '开窗放大
If Abs(mx - mx0) < Unit Or Abs(my - my0) < Unit Then Exit Sub
Me.Line (mx0, my0)-(mx, my), vbCyan, B '移动
xWmin = IIf(mx < mx0, mx, mx0)
xWmax = IIf(mx < mx0, mx0, mx)
yWmin = IIf(my < my0, my, my0)
yWmax = IIf(my < my0, my0, my)
End If
End If
Me.Scale (xWmin, yWmax)-(xWmax, yWmin)
mStructor.DrawConstruct Me, vbRed
Select Case GraphType
Case 2, 5
mStructor.GetXYDis 1, scale1
mStructor.DrawConstructDis Me, vbCyan
Case 3
mStructor.DrawForce Me, vbCyan
Case 4
mStructor.DrawConstructDis Me, vbCyan
mStructor.DrawForce Me, vbBlue
End Select
End Sub
Private Sub Form_Resize()
If Height < 1000 Then Exit Sub
If Width < 1000 Then Exit Sub
Me.Scale (xWmin, yWmax)-(xWmax, yWmin)
mStructor.DrawConstruct Me, vbRed
Select Case GraphType
Case 2, 5
mStructor.GetXYDis 1, scale1
mStructor.DrawConstructDis Me, vbCyan
Case 3
mStructor.DrawForce Me, vbCyan
Case 4
mStructor.DrawConstructDis Me, vbCyan
mStructor.DrawForce Me, vbBlue
End Select
End Sub
Private Sub Form_Unload(Cancel As Integer)
times.Visible = False
GraphType = 0
End Sub
'是否显示杆件编号
Private Sub GJnum_Click()
mStructor.DrawGJnum Me, vbMagenta
End Sub
Private Sub mnuZoom_Click(Index As Integer)
If HaveShowGraph = False Then Exit Sub
GraphOperType = Index
If Index = 0 Then
mStructor.CalScale Me
mStructor.DrawConstruct Me, vbRed
Select Case GraphType
Case 2, 5
mStructor.GetXYDis 1, scale1
mStructor.DrawConstructDis Me, vbCyan
Case 3
mStructor.DrawForce Me, vbCyan
Case 4
mStructor.DrawConstructDis Me, vbCyan
mStructor.DrawForce Me, vbBlue
End Select
End If
End Sub
'是否显示节点编号
Private Sub NodeNum_Click()
mStructor.DrawNodeNum Me, vbWhite
End Sub
'保存生成的图片
Private Sub save_Click()
Dim X1 As Long
Dim Y1 As Long
Dim X2 As Long
Dim Y2 As Long
X1 = Me.Left / Screen.TwipsPerPixelX + 4
Y1 = Me.Top / Screen.TwipsPerPixelY + 50
X2 = Me.Width / Screen.TwipsPerPixelX + X1 - 8
Y2 = Me.Height / Screen.TwipsPerPixelY + Y1 - 55
ScrnCap X1, Y1, X2, Y2
Source = Clipboard.GetData
On Error GoTo nocation
CoD1.CancelError = True
CoD1.InitDir = App.Path
CoD1.Filter = "Windows位图文件 | *.bmp"
CoD1.Action = 2 ' CoD1.ShowSave
SavePicture Clipboard.GetData, CoD1.filename
Exit Sub
nocation:
Exit Sub
End Sub
Private Sub times_Click()
scaleform.Show , Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -