📄 jzdinput.vb
字号:
Public Class JZDInput
Inherits System.Windows.Forms.Form
'=========================================
'使用手工输入的方式输入坐标
'分为4种类型:
'1.输入绝对坐标
'2.输入相对坐标
'3.输入方位角和距离
'4.输入垂直距离
'=========================================
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents Panel1 As System.Windows.Forms.Panel
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents btn确定输入 As System.Windows.Forms.Button
Friend WithEvents btn关闭 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Panel1 = New System.Windows.Forms.Panel
Me.btn关闭 = New System.Windows.Forms.Button
Me.btn确定输入 = New System.Windows.Forms.Button
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.Label2 = New System.Windows.Forms.Label
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Label1 = New System.Windows.Forms.Label
Me.Panel1.SuspendLayout()
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'Panel1
'
Me.Panel1.Controls.Add(Me.btn关闭)
Me.Panel1.Controls.Add(Me.btn确定输入)
Me.Panel1.Dock = System.Windows.Forms.DockStyle.Bottom
Me.Panel1.Location = New System.Drawing.Point(0, 63)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(298, 40)
Me.Panel1.TabIndex = 0
'
'btn关闭
'
Me.btn关闭.Location = New System.Drawing.Point(208, 8)
Me.btn关闭.Name = "btn关闭"
Me.btn关闭.Size = New System.Drawing.Size(72, 24)
Me.btn关闭.TabIndex = 3
Me.btn关闭.Text = "关闭"
'
'btn确定输入
'
Me.btn确定输入.Location = New System.Drawing.Point(24, 8)
Me.btn确定输入.Name = "btn确定输入"
Me.btn确定输入.Size = New System.Drawing.Size(72, 24)
Me.btn确定输入.TabIndex = 2
Me.btn确定输入.Text = "确定输入"
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.TextBox2)
Me.GroupBox1.Controls.Add(Me.Label2)
Me.GroupBox1.Controls.Add(Me.TextBox1)
Me.GroupBox1.Controls.Add(Me.Label1)
Me.GroupBox1.Dock = System.Windows.Forms.DockStyle.Fill
Me.GroupBox1.Location = New System.Drawing.Point(0, 0)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(298, 63)
Me.GroupBox1.TabIndex = 1
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "输入坐标或距离"
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(192, 32)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(96, 21)
Me.TextBox2.TabIndex = 1
Me.TextBox2.Text = "TextBox2"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(152, 32)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(40, 16)
Me.Label2.TabIndex = 2
Me.Label2.Text = "Y:"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(48, 32)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(96, 21)
Me.TextBox1.TabIndex = 0
Me.TextBox1.Text = "TextBox1"
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(8, 32)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(40, 24)
Me.Label1.TabIndex = 0
Me.Label1.Text = "X:"
'
'JZDInput
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(298, 103)
Me.ControlBox = False
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.Panel1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "JZDInput"
Me.ShowInTaskbar = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "坐标输入对话框"
Me.TopMost = True
Me.Panel1.ResumeLayout(False)
Me.GroupBox1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
'==============================
Private m_pTool As myZDEditor.ZDCut '当前的创建工具
Public Property CurrentCreateTool() As myZDEditor.ZDCut
Get
Return m_pTool
End Get
Set(ByVal Value As myZDEditor.ZDCut)
m_pTool = Value
End Set
End Property
Private Sub JZDInput_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.TextBox1.Text = ""
Me.TextBox2.Text = ""
End Sub
Private Sub btn关闭_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn关闭.Click
Me.m_pTool.IsDialog = False
Me.m_pTool.DialogForm = Nothing
Me.Close()
End Sub
Private Sub btn确定输入_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn确定输入.Click
Dim x As Double, y As Double
x = Val(Me.TextBox1.Text)
y = Val(Me.TextBox2.Text)
Me.m_pTool.InputXY(x, y)
Me.TextBox1.Text = ""
Me.TextBox2.Text = ""
Me.TextBox1.Focus()
'==========================
End Sub
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar = Chr(Keys.Back) Then Exit Sub
If e.KeyChar = Chr(Keys.Enter) Then
Me.TextBox2.Focus()
Else
If (e.KeyChar < "0" Or e.KeyChar > "9") And e.KeyChar <> "." And e.KeyChar <> "-" Then '处理只输入数字
e.Handled = True '注意此设置,与VB6不同
Beep()
SendKeys.Send("")
End If
End If
End Sub
Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
If e.KeyChar = Chr(Keys.Back) Then Exit Sub
If e.KeyChar = Chr(Keys.Enter) Then
Me.btn确定输入.Focus()
Else
If (e.KeyChar < "0" Or e.KeyChar > "9") And e.KeyChar <> "." And e.KeyChar <> "-" Then '处理只输入数字
e.Handled = True '注意此设置,与VB6不同
Beep()
SendKeys.Send("")
End If
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -