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

📄 form1.vb

📁 vb 应用实例 简单应用 ddddddddddddddddddddddddddddddddd
💻 VB
字号:
Imports System.Xml

Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form  "

    Public Sub New()
        MyBase.New()

        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

    Private components As System.ComponentModel.IContainer

    Friend WithEvents Button4 As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Button4 = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'Button4
        '
        Me.Button4.Location = New System.Drawing.Point(10, 16)
        Me.Button4.Name = "Button4"
        Me.Button4.Size = New System.Drawing.Size(113, 24)
        Me.Button4.TabIndex = 3
        Me.Button4.Text = "添加表单"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(296, 70)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button4})
        Me.Name = "Form1"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "在程序中添加表单"
        Me.ResumeLayout(False)

    End Sub

#End Region



    Private m_Location As New Point(10, 16)

    ' Create constants to use in the form.
    Private Const CONTROL_WIDTH As Integer = 300
    Private Const CHARS_PER_LINE As Integer = 30
    Private Const HEIGHT_PER_LINE As Integer = 19

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Dim frm2 As New Form2()

        Dim frm2Controls As Control.ControlCollection = frm2.From2Controls

        m_Location = New Point(10, 16)

        Dim xml1 As New Xml.XmlDocument()
        xml1.Load("..\From2.xml")

        'From2
        Dim myTag As String = xml1.SelectSingleNode("//MyForm2").Attributes("name").Value

        frm2.From2Title = xml1.SelectSingleNode("//MyForm2").Attributes("displayName").Value

        Dim nodeList As Xml.XmlNodeList
        nodeList = xml1.GetElementsByTagName("拜肈")

        Dim myNode As XmlNode
        For Each myNode In nodeList
            If Not myNode.Attributes Is Nothing Then
                Select Case myNode.Attributes("type").Value
                    Case "dropdown"
                        m_Location = frm2_AddComboBox(myNode, frm2Controls, m_Location, myTag)
                    Case "multilist"
                        m_Location = frm2_AddListBox(myNode, frm2Controls, m_Location, myTag, True)
                    Case "text"
                        m_Location = frm2_AddTextBox(myNode, frm2Controls, m_Location, myTag)
                    Case "radio"
                        m_Location = frm2_AddRadioButtons(myNode, frm2Controls, m_Location, myTag)
                End Select
            End If
        Next

        frm2.Width = m_Location.X + CONTROL_WIDTH + 30
        frm2.Height = m_Location.Y + 75

        frm2.Button1.Location = New Point(frm2.Button1.Location.X, m_Location.Y)
        frm2.Button2.Location = New Point(frm2.Button2.Location.X, m_Location.Y)

        frm2.ShowDialog()

        MsgBox(frm2.From2Response, MsgBoxStyle.OKOnly, Me.Text)

    End Sub



    '

⌨️ 快捷键说明

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