📄 查看预览图.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
Object = "{6307A290-67B8-11D0-8744-0000C06B6F77}#2.0#0"; "DWGTHU~1.OCX"
Begin VB.Form unitlist
Caption = "查图"
ClientHeight = 11010
ClientLeft = 60
ClientTop = 450
ClientWidth = 15240
Icon = "查看预览图.frx":0000
LinkTopic = "Form3"
ScaleHeight = 11010
ScaleWidth = 15240
StartUpPosition = 3 '窗口缺省
WindowState = 2 'Maximized
Begin VB.CommandButton tablekey
Caption = "构成表管理"
Height = 420
Left = 3240
TabIndex = 0
Top = 10320
Width = 1095
End
Begin VB.CommandButton dwgmanagerkey
Caption = "图纸管理"
Height = 375
Left = 1800
TabIndex = 15
Top = 10320
Width = 1095
End
Begin VB.CommandButton forekey
Caption = "上一个"
Height = 375
Left = 11040
TabIndex = 14
Top = 10320
Width = 1095
End
Begin VB.CommandButton nextkey
Caption = "下一个"
Height = 375
Left = 12480
TabIndex = 13
Top = 10320
Width = 1095
End
Begin VB.CheckBox Check1
Caption = "启用模糊选择"
ForeColor = &H000000FF&
Height = 375
Left = 13440
TabIndex = 12
Top = 360
Width = 1575
End
Begin VB.CommandButton unloadkey
Caption = "退出"
Height = 375
Left = 13920
TabIndex = 10
Top = 10320
Width = 1095
End
Begin VB.CommandButton viewmore
Caption = "查看详图"
Height = 375
Left = 360
TabIndex = 6
Top = 10320
Width = 1095
End
Begin VB.ComboBox Combo1
Height = 300
Left = 10080
TabIndex = 3
Top = 360
Width = 2535
End
Begin VB.TextBox Text1
Height = 375
Left = 3600
TabIndex = 2
Top = 360
Width = 6015
End
Begin MSHierarchicalFlexGridLib.MSHFlexGrid showmodelGrid
Height = 8895
Left = 3600
TabIndex = 1
Top = 1200
Width = 11535
_ExtentX = 20346
_ExtentY = 15690
_Version = 393216
_NumberOfBands = 1
_Band(0).Cols = 2
End
Begin MSComctlLib.ImageList ilsTRee
Left = 1440
Top = 6120
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 4
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "查看预览图.frx":058A
Key = "unselect"
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "查看预览图.frx":08DC
Key = "root"
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "查看预览图.frx":0C2E
Key = "all"
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "查看预览图.frx":11C8
Key = "select"
EndProperty
EndProperty
End
Begin MSComctlLib.TreeView modeltreeview
Height = 6015
Left = 120
TabIndex = 11
Top = 360
Width = 3255
_ExtentX = 5741
_ExtentY = 10610
_Version = 393217
Indentation = 353
LabelEdit = 1
Style = 7
ImageList = "ilsTRee"
Appearance = 1
End
Begin DWGTHUMBNAILLib.DwgThumbnail DwgThumbnail1
Height = 2895
Left = 240
TabIndex = 16
Top = 7080
Width = 3135
_Version = 131072
_ExtentX = 5530
_ExtentY = 5106
_StockProps = 225
BorderStyle = 1
End
Begin VB.Label Label5
Caption = "构成表"
Height = 255
Left = 3600
TabIndex = 9
Top = 960
Width = 2055
End
Begin VB.Label Label4
Caption = "类别"
Height = 255
Left = 10080
TabIndex = 8
Top = 120
Width = 855
End
Begin VB.Label Label3
Caption = "查找"
Height = 375
Left = 3600
TabIndex = 7
Top = 120
Width = 735
End
Begin VB.Label Label1
Caption = "机型选择"
Height = 255
Left = 120
TabIndex = 4
Top = 120
Width = 1215
End
Begin VB.Label Label2
Caption = "预览"
Height = 255
Left = 120
TabIndex = 5
Top = 6600
Width = 735
End
End
Attribute VB_Name = "unitlist"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public showdwgfile As String
Public Fsopreview As New FileSystemObject
Public Node As Node
Public modelName As String
Public modelid As String
Dim sqlunit As String
Private Sub modeltreeview_NodeClick(ByVal Node As MSComctlLib.Node)
Dim modelid As String
Dim sqlmodel As String
Dim rsmodelshow As New ADODB.Recordset
If Node.Key <> "full" Then
'modelid = Mid(Node.Key, 2, Len(Node.Key) - 1)
sqlmodel = Trim(Node.Text)
If TableExists(sqlmodel, cn) = True Then
sqlmodel = "SELECT * FROM [" & sqlmodel & "]"
Else
showdwgfile = App.path & "\test.dwg"
DwgThumbnail1.DwgFileName = showdwgfile
showmodelGrid.Clear
MsgBox sqlmodel & "机型尚未导入构成表!", vbInformation, "通知"
Exit Sub
End If
Call rsmodelshow.Open(sqlmodel, cn, adOpenKeyset, adLockOptimistic, -1)
Set showmodelGrid.DataSource = rsmodelshow
Call machineShowGrid(rsmodelshow, showmodelGrid)
rsmodelshow.Close
Else
showdwgfile = App.path & "\test.dwg"
DwgThumbnail1.DwgFileName = showdwgfile
sqlmodel = "SELECT * FROM 机型登记"
Call rsmodelshow.Open(sqlmodel, cn, adOpenKeyset, adLockOptimistic, -1)
Set showmodelGrid.DataSource = rsmodelshow
Call 主菜单.modelShowGrid(rsmodelshow, showmodelGrid)
rsmodelshow.Close
End If
End Sub
Private Sub showmodelGrid_SelChange()
If showmodelGrid.Rows <= 0 Or showmodelGrid.Cols <= 0 Or showmodelGrid.Row = 0 Then
Exit Sub
End If
Dim codedwg As String
Dim versiondwg As String
If Node.Key = "full" Then
showdwgfile = App.path & "\test.dwg"
DwgThumbnail1.DwgFileName = App.path & "\test.dwg"
Exit Sub
End If
With showmodelGrid
If .TextMatrix(.Row, 1) <> Empty Then '第一列,序号列
codedwg = Trim(.TextMatrix(.Row, 3)) '第三列,图纸代号列
versiondwg = Trim(.TextMatrix(.Row, 4)) '第四列,版号列
showdwgfile = App.path & "\autocad\" & codedwg & "(" & versiondwg & ").dwg"
If Fsopreview.FileExists(showdwgfile) = True Then
DwgThumbnail1.DwgFileName = showdwgfile
Else
DwgThumbnail1.DwgFileName = App.path & "\test.dwg"
End If
Else
showdwgfile = App.path & "\test.dwg"
DwgThumbnail1.DwgFileName = App.path & "\test.dwg"
End If
End With
End Sub
Public Sub machineShowGrid(ByVal Recordset As ADODB.Recordset, ByVal flexGrid As MSHFlexGrid)
Dim i As Integer
With flexGrid
.Visible = True
.SelectionMode = flexSelectionByRow
.ScrollBars = flexScrollBarBoth
.FillStyle = flexFillSingle
.ScrollTrack = True
.AllowUserResizing = flexResizeColumns
.ColWidth(0) = 5
.ColWidth(1) = 500
.ColWidth(2) = 2000
.ColWidth(3) = 2000
.ColWidth(4) = 500
.ColWidth(5) = 3000
.ColWidth(6) = 4000
.ColWidth(7) = 500
.ColWidth(8) = 500
.ColWidth(9) = 500
.ColWidth(10) = 1200
.ColWidth(11) = 1000
.ColAlignment(0) = 2
.ColAlignment(1) = 3 '水平居中,垂直居中对齐
.ColAlignment(2) = 2
.ColAlignment(3) = 2
.ColAlignment(4) = 3
.ColAlignment(5) = 2
.ColAlignment(6) = 2
.ColAlignment(7) = 3
.ColAlignment(8) = 3
.ColAlignment(9) = 3
.ColAlignment(10) = 3
.ColAlignment(11) = 3
.ColAlignmentFixed(1) = 3
.ColAlignmentFixed(2) = 3 '设置表格标题的对齐方式
.ColAlignmentFixed(3) = 3
.ColAlignmentFixed(4) = 3
.ColAlignmentFixed(5) = 3
.ColAlignmentFixed(6) = 3
.ColAlignmentFixed(7) = 3
.ColAlignmentFixed(8) = 3
.ColAlignmentFixed(9) = 3
.ColAlignmentFixed(10) = 3
.ColAlignmentFixed(11) = 3
End With
For i = 1 To flexGrid.Rows - 1
flexGrid.Row = i
For j = 1 To flexGrid.Cols - 1
flexGrid.Col = j
If (flexGrid.Row Mod 2) = 0 Then
flexGrid.CellBackColor = &HE0E0E0
Else
flexGrid.CellBackColor = vbWhite
End If
Next j
Next i
'flexGrid.Refresh
End Sub
Private Sub dwgmanagerkey_Click()
dwgmanager.Show
End Sub
Private Sub unloadkey_Click()
Unload Me
End Sub
Private Sub DwgThumbnail1_Click()
viewprint.Show
If Fsopreview.FileExists(showdwgfile) = True Then
viewprint.DwgViewX1.DrawingFile = showdwgfile
Else
viewprint.DwgViewX1.DrawingFile = App.path & "\test.dwg"
End If
End Sub
Private Sub Form_Load()
MakeCenter Me
showdwgfile = App.path & "\test.dwg"
DwgThumbnail1.DwgFileName = showdwgfile
sqlunit = "SELECT * FROM 机型登记"
Call modelrs.Open(sqlunit, cn, adOpenKeyset, adLockOptimistic, -1)
Call InimodelTreeView(modeltreeview)
End Sub
Public Sub InimodelTreeView(ByVal modeltree As TreeView)
With modeltree
.LineStyle = tvwRootLines
Set Node = .Nodes.Add(, , "full", "全部机型")
Node.Image = "all"
If modelrs.RecordCount > 0 Then
modelrs.MoveFirst
While Not modelrs.EOF
modelid = "I" & Trim(modelrs.Fields("编号"))
modelName = Trim(modelrs.Fields("机型代号"))
Set Node = .Nodes.Add("full", 4, modelid, modelName)
Node.Image = "unselect"
Node.SelectedImage = "select"
modelrs.MoveNext
Wend
End If
If .Nodes("full").Children > 0 Then
.Nodes("full").Expanded = True
End If
End With
End Sub
Private Sub viewmore_Click()
viewprint.Show
If Fsopreview.FileExists(showdwgfile) = True Then
viewprint.DwgViewX1.DrawingFile = showdwgfile
Else
viewprint.DwgViewX1.DrawingFile = App.path & "\test.dwg"
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
modelrs.Close
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -