⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmselectfeature.vb

📁 用VB.NET开发的GeoMedia一个实例
💻 VB
字号:
Public Class FrmSelectFeature
    Inherits System.Windows.Forms.Form

#Region " Windows 窗体设计器生成的代码 "

    Public Sub New()
        MyBase.New()

        '该调用是 Windows 窗体设计器所必需的。
        InitializeComponent()

        '在 InitializeComponent() 调用之后添加任何初始化

    End Sub

    '窗体重写处置以清理组件列表。
    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 Label1 As System.Windows.Forms.Label
    Friend WithEvents lstFeature As System.Windows.Forms.ListBox
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents btnOK As System.Windows.Forms.Button
    Friend WithEvents btnCancel As System.Windows.Forms.Button
    Friend WithEvents txtLocation As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.lstFeature = New System.Windows.Forms.ListBox()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.btnOK = New System.Windows.Forms.Button()
        Me.btnCancel = New System.Windows.Forms.Button()
        Me.txtLocation = New System.Windows.Forms.TextBox()
        Me.SuspendLayout()
        '
        'lstFeature
        '
        Me.lstFeature.HorizontalScrollbar = True
        Me.lstFeature.ItemHeight = 12
        Me.lstFeature.Location = New System.Drawing.Point(5, 82)
        Me.lstFeature.Name = "lstFeature"
        Me.lstFeature.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
        Me.lstFeature.Size = New System.Drawing.Size(287, 232)
        Me.lstFeature.TabIndex = 0
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(5, 12)
        Me.Label1.Name = "Label1"
        Me.Label1.TabIndex = 2
        Me.Label1.Text = "数据库"
        Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(6, 64)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(100, 11)
        Me.Label2.TabIndex = 3
        Me.Label2.Text = "设备"
        '
        'btnOK
        '
        Me.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.btnOK.Location = New System.Drawing.Point(34, 326)
        Me.btnOK.Name = "btnOK"
        Me.btnOK.TabIndex = 4
        Me.btnOK.Text = "确定"
        '
        'btnCancel
        '
        Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.btnCancel.Location = New System.Drawing.Point(163, 327)
        Me.btnCancel.Name = "btnCancel"
        Me.btnCancel.TabIndex = 5
        Me.btnCancel.Text = "取消"
        '
        'txtLocation
        '
        Me.txtLocation.Location = New System.Drawing.Point(6, 34)
        Me.txtLocation.Name = "txtLocation"
        Me.txtLocation.ReadOnly = True
        Me.txtLocation.Size = New System.Drawing.Size(285, 21)
        Me.txtLocation.TabIndex = 6
        Me.txtLocation.Text = ""
        '
        'FrmSelectFeature
        '
        Me.AcceptButton = Me.btnOK
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.CancelButton = Me.btnCancel
        Me.ClientSize = New System.Drawing.Size(298, 358)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.txtLocation, Me.btnCancel, Me.btnOK, Me.Label2, Me.Label1, Me.lstFeature})
        Me.Name = "FrmSelectFeature"
        Me.ShowInTaskbar = False
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
        Me.Text = "FrmSelectFeature"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
    End Sub

    Private Sub FrmSelectFeature_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim strConnLocation As String
        Dim alFeatureName As ArrayList
        Dim i As Integer

        Me.txtLocation.Text = gobjConnection.Location
        Me.lstFeature.Items.Clear()

        alFeatureName = Common.GeometryOP.GetFeatureNameList()
        For i = 0 To alFeatureName.Count - 1
            Me.lstFeature.Items.Add(alFeatureName(i))
        Next

    End Sub

    Private Sub InitForm()
        On Error GoTo ErrorHandler
        Dim strConnLocation As String
        Dim alFeatureName As ArrayList
        Dim i As Integer

        Me.txtLocation.Text = gobjConnection.Location
        Me.lstFeature.Items.Clear()

        alFeatureName = Common.GeometryOP.GetFeatureNameList()
        For i = 0 To alFeatureName.Count - 1
            Me.lstFeature.Items.Add(alFeatureName.Item(i))
        Next

        Exit Sub
ErrorHandler:
        MsgBox(Err.Description, MSGBOX_ERROR, "Select Feature")
    End Sub

    Public Function GetSelectFeatureInfo() As ArrayList
        Dim strFeatures As New ArrayList()
        Dim i As Integer

        If gobjConnection.Status = 1 Then       '表示数据库的连接已打开
            Me.InitForm()
            If Me.ShowDialog = DialogResult.OK Then
                For i = 0 To Me.lstFeature.SelectedItems.Count - 1
                    strFeatures.Add(Me.lstFeature.SelectedItems(i))
                Next
                Return strFeatures
            End If
        Else
            MsgBox("You must open a connection first.", MSGBOX_ERROR, "Select Feature")
        End If
    End Function


    Private Sub lstFeature_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstFeature.DoubleClick
        Me.DialogResult = DialogResult.OK
        Me.Close()

    End Sub

End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -