📄 frmzoomdialog.frm
字号:
VERSION 5.00
Begin VB.Form frmZoomDialog
BorderStyle = 3 'Fixed Dialog
Caption = "Set Zoom..."
ClientHeight = 1050
ClientLeft = 4110
ClientTop = 5340
ClientWidth = 3315
Icon = "frmZoomDialog.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1050
ScaleWidth = 3315
ShowInTaskbar = 0 'False
Begin VB.TextBox ZoomText
Height = 285
Left = 120
TabIndex = 1
Text = "250"
Top = 120
Width = 1455
End
Begin VB.CommandButton cmdApply
Caption = "&Apply"
Height = 375
Left = 2280
TabIndex = 4
Top = 600
Width = 975
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "Cancel"
Height = 375
Left = 1200
TabIndex = 3
Top = 600
Width = 975
End
Begin VB.CommandButton cmdOK
Caption = "OK"
Default = -1 'True
Height = 375
Left = 120
TabIndex = 2
Top = 600
Width = 975
End
Begin VB.ComboBox UnitCombo
Height = 315
ItemData = "frmZoomDialog.frx":0442
Left = 1680
List = "frmZoomDialog.frx":0479
Style = 2 'Dropdown List
TabIndex = 0
Top = 120
Width = 1575
End
End
Attribute VB_Name = "frmZoomDialog"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
' This sample application and corresponding sample code is provided
' for example purposes only. It has not undergone rigorous testing
' and as such should not be shipped as part of a final application
' without extensive testing on the part of the organization releasing
' the end-user product.
Dim OldZoom As Double ' These are used to restore the state when "cancel" is pressed
Dim OldUnit As Integer
Private Sub Form_Load()
' Set the ZoomText text box to the current zoom
ZoomText.Text = fMainForm.Map1.Zoom
' Set the unit combo box to the current unit
' Take a short cut: units # 0 through 13 correspond to combo list number
If fMainForm.Map1.MapUnit < 14 Then
UnitCombo.ListIndex = fMainForm.Map1.MapUnit
Else
Select Case fMainForm.Map1.MapUnit
Case miUnitLink
UnitCombo.ListIndex = 14
Case miUnitChain
UnitCombo.ListIndex = 15
Case miUnitRod
UnitCombo.ListIndex = 16
End Select
End If
' Save the current parameters so that the view can be
' restored if "cancel" is pressed
OldZoom = fMainForm.Map1.Zoom
OldUnit = fMainForm.Map1.MapUnit
cmdApply.Enabled = False
End Sub
Private Sub cmdApply_Click()
On Error GoTo Err
fMainForm.Map1.Zoom = ZoomText
cmdApply.Enabled = False
Err:
MsgBox "Please enter a valid numeric value for the zoom."
End Sub
Private Sub cmdCancel_Click()
' Restore the old view parameters.
fMainForm.Map1.MapUnit = OldUnit
fMainForm.Map1.Zoom = OldZoom
Unload Me
End Sub
Private Sub cmdOK_Click()
On Error GoTo Err
fMainForm.Map1.Zoom = ZoomText
Unload Me
Exit Sub
Err:
MsgBox "Please enter a valid numeric value for the zoom."
End Sub
Private Sub ZoomText_Change()
cmdApply.Enabled = True
End Sub
Private Sub UnitCombo_Click()
' Change the map units, and display the zoom in the new units
Select Case UnitCombo.ListIndex
Case 0 ' Miles
fMainForm.Map1.MapUnit = miUnitMile
Case 1 ' Kilometers
fMainForm.Map1.MapUnit = miUnitKilometer
Case 2 ' Inches
fMainForm.Map1.MapUnit = miUnitInch
Case 3 ' Feet
fMainForm.Map1.MapUnit = miUnitFoot
Case 4 ' Yards
fMainForm.Map1.MapUnit = miUnitYard
Case 5 ' Millimeters
fMainForm.Map1.MapUnit = miUnitMillimeter
Case 6 ' Centimeters
fMainForm.Map1.MapUnit = miUnitCentimeter
Case 7 ' Meters
fMainForm.Map1.MapUnit = miUnitMeter
Case 8 ' Survey Feet
fMainForm.Map1.MapUnit = miUnitSurveyFoot
Case 9 ' Nautical Miles
fMainForm.Map1.MapUnit = miUnitNauticalMile
Case 10 ' Twips
fMainForm.Map1.MapUnit = miUnitTwip
Case 11 ' Points
fMainForm.Map1.MapUnit = miUnitPoint
Case 12 ' Picas
fMainForm.Map1.MapUnit = miUnitPica
Case 13 ' Degrees
fMainForm.Map1.MapUnit = miUnitDegree
Case 14 ' Links
fMainForm.Map1.MapUnit = miUnitLink
Case 15 ' Chains
fMainForm.Map1.MapUnit = miUnitChain
Case 16 ' Rods
fMainForm.Map1.MapUnit = miUnitRod
End Select
ZoomText.Text = fMainForm.Map1.Zoom
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -