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

📄 mainmdi.vb

📁 这是一个VBA开发的项目实例
💻 VB
字号:
Public Class MainMDI
    Inherits System.Windows.Forms.Form
    'this variable is defined to capture the client name and id globally
    Private varCompanyName As New StartApplication.ShareClass()
    

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    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
    Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
    Friend WithEvents PictureBox2 As System.Windows.Forms.PictureBox
    Friend WithEvents PictureBox3 As System.Windows.Forms.PictureBox
    Friend WithEvents PictureBox4 As System.Windows.Forms.PictureBox
    Friend WithEvents PictureBox5 As System.Windows.Forms.PictureBox
    Friend WithEvents PictureBox6 As System.Windows.Forms.PictureBox

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(MainMDI))
        Me.PictureBox1 = New System.Windows.Forms.PictureBox()
        Me.PictureBox2 = New System.Windows.Forms.PictureBox()
        Me.PictureBox3 = New System.Windows.Forms.PictureBox()
        Me.PictureBox4 = New System.Windows.Forms.PictureBox()
        Me.PictureBox5 = New System.Windows.Forms.PictureBox()
        Me.PictureBox6 = New System.Windows.Forms.PictureBox()
        Me.SuspendLayout()
        '
        'PictureBox1
        '
        Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Bitmap)
        Me.PictureBox1.Name = "PictureBox1"
        Me.PictureBox1.Size = New System.Drawing.Size(112, 104)
        Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
        Me.PictureBox1.TabIndex = 1
        Me.PictureBox1.TabStop = False
        '
        'PictureBox2
        '
        Me.PictureBox2.Image = CType(resources.GetObject("PictureBox2.Image"), System.Drawing.Bitmap)
        Me.PictureBox2.Location = New System.Drawing.Point(0, 101)
        Me.PictureBox2.Name = "PictureBox2"
        Me.PictureBox2.Size = New System.Drawing.Size(112, 72)
        Me.PictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
        Me.PictureBox2.TabIndex = 2
        Me.PictureBox2.TabStop = False
        '
        'PictureBox3
        '
        Me.PictureBox3.Image = CType(resources.GetObject("PictureBox3.Image"), System.Drawing.Bitmap)
        Me.PictureBox3.Location = New System.Drawing.Point(0, 173)
        Me.PictureBox3.Name = "PictureBox3"
        Me.PictureBox3.Size = New System.Drawing.Size(112, 72)
        Me.PictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
        Me.PictureBox3.TabIndex = 3
        Me.PictureBox3.TabStop = False
        '
        'PictureBox4
        '
        Me.PictureBox4.Image = CType(resources.GetObject("PictureBox4.Image"), System.Drawing.Bitmap)
        Me.PictureBox4.Location = New System.Drawing.Point(0, 245)
        Me.PictureBox4.Name = "PictureBox4"
        Me.PictureBox4.Size = New System.Drawing.Size(112, 72)
        Me.PictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
        Me.PictureBox4.TabIndex = 4
        Me.PictureBox4.TabStop = False
        '
        'PictureBox5
        '
        Me.PictureBox5.Image = CType(resources.GetObject("PictureBox5.Image"), System.Drawing.Bitmap)
        Me.PictureBox5.Location = New System.Drawing.Point(0, 317)
        Me.PictureBox5.Name = "PictureBox5"
        Me.PictureBox5.Size = New System.Drawing.Size(112, 72)
        Me.PictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
        Me.PictureBox5.TabIndex = 5
        Me.PictureBox5.TabStop = False
        '
        'PictureBox6
        '
        Me.PictureBox6.Image = CType(resources.GetObject("PictureBox6.Image"), System.Drawing.Bitmap)
        Me.PictureBox6.Location = New System.Drawing.Point(0, 389)
        Me.PictureBox6.Name = "PictureBox6"
        Me.PictureBox6.Size = New System.Drawing.Size(112, 64)
        Me.PictureBox6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
        Me.PictureBox6.TabIndex = 6
        Me.PictureBox6.TabStop = False
        '
        'MainMDI
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(680, 453)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.PictureBox6, Me.PictureBox5, Me.PictureBox4, Me.PictureBox3, Me.PictureBox2, Me.PictureBox1})
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
        Me.IsMdiContainer = True
        Me.Name = "MainMDI"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "Easy Selling Version 1.0.0"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub MainMDI_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim NewMDIChild As New StartApplication()
        'Set the Parent Form of the Child window.
        NewMDIChild.MdiParent = Me
        'Display the new form.
        NewMDIChild.Show()
        'position the displayed form
        NewMDIChild.Left = 110
        NewMDIChild.Top = 0
    End Sub

    Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click
        Dim NewMDIChild As New ClientInfo()
        'Set the Parent Form of the Child window.
        NewMDIChild.MdiParent = Me
        'Display the new form.
        NewMDIChild.Show()
        'position the displayed form
        NewMDIChild.Left = 110
        NewMDIChild.Top = 0
        'set the proper images in picture boxes according to the state that they should be in
        PictureBox2.Image = System.Drawing.Image.FromFile("c:\easyselling\Customers_sel.jpg")
        PictureBox3.Image = System.Drawing.Image.FromFile("c:\easyselling\Issues_def.jpg")
        PictureBox4.Image = System.Drawing.Image.FromFile("c:\easyselling\solutions_def.jpg")
        PictureBox5.Image = System.Drawing.Image.FromFile("c:\easyselling\outputs_def.jpg")
    End Sub

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

    Private Sub PictureBox3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox3.Click
        'check if a customer is selected or not
        If (Trim(varCompanyName.SharedValue) = "" Or varCompanyName.SharedClientID = 0) Then
            MsgBox("Select a Customer from the List", MsgBoxStyle.Information, "No Customer Selected")
        Else
            Dim NewMDIChild As New ClientIssues()
            'Set the Parent Form of the Child window.
            NewMDIChild.MdiParent = Me
            'Display the new form.
            NewMDIChild.Show()
            'position the displayed form
            NewMDIChild.Left = 110
            NewMDIChild.Top = 0
            'set the proper images in picture boxes according to the state that they should be in
            PictureBox3.Image = System.Drawing.Image.FromFile("c:\easyselling\Issues_sel.jpg")
            PictureBox2.Image = System.Drawing.Image.FromFile("c:\easyselling\customers_def.jpg")
            PictureBox4.Image = System.Drawing.Image.FromFile("c:\easyselling\solutions_def.jpg")
            PictureBox5.Image = System.Drawing.Image.FromFile("c:\easyselling\outputs_def.jpg")
        End If
    End Sub


    Private Sub PictureBox4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox4.Click
        'check if a customer is selected or not
        If (Trim(varCompanyName.SharedValue) = "" Or varCompanyName.SharedClientID = 0) Then
            MsgBox("Select a Customer from the List", MsgBoxStyle.Information, "No Customer Selected")
        Else
            Dim NewMDIChild As New ClientSolutions()
            'Set the Parent Form of the Child window.
            NewMDIChild.MdiParent = Me
            'Display the new form.
            NewMDIChild.Show()
            'position the displayed form
            NewMDIChild.Left = 110
            NewMDIChild.Top = 0
            'set the proper images in picture boxes according to the state that they should be in
            PictureBox4.Image = System.Drawing.Image.FromFile("c:\easyselling\solutions_sel.jpg")
            PictureBox2.Image = System.Drawing.Image.FromFile("c:\easyselling\customers_def.jpg")
            PictureBox3.Image = System.Drawing.Image.FromFile("c:\easyselling\Issues_def.jpg")
            PictureBox5.Image = System.Drawing.Image.FromFile("c:\easyselling\outputs_def.jpg")
        End If
    End Sub

    Private Sub PictureBox5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox5.Click
        'check if a customer is selected or not
        If (Trim(varCompanyName.SharedValue) = "" Or varCompanyName.SharedClientID = 0) Then
            MsgBox("Select a Customer from the List", MsgBoxStyle.Information, "No Customer Selected")
        Else
            Dim NewMDIChild As New ClientDocuments()
            'Set the Parent Form of the Child window.
            NewMDIChild.MdiParent = Me
            'Display the new form.
            NewMDIChild.Show()
            'position the displayed form
            NewMDIChild.Left = 110
            NewMDIChild.Top = 0
            'set the proper images in picture boxes according to the state that they should be in
            PictureBox5.Image = System.Drawing.Image.FromFile("c:\easyselling\outputs_sel.jpg")
            PictureBox2.Image = System.Drawing.Image.FromFile("c:\easyselling\customers_def.jpg")
            PictureBox3.Image = System.Drawing.Image.FromFile("c:\easyselling\Issues_def.jpg")
            PictureBox4.Image = System.Drawing.Image.FromFile("c:\easyselling\solutions_def.jpg")

        End If
    End Sub


    Private Sub MainMDI_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated
        'reset the images in the picture boxes to default images
        PictureBox2.Image = System.Drawing.Image.FromFile("c:\easyselling\customers_def.jpg")
        PictureBox3.Image = System.Drawing.Image.FromFile("c:\easyselling\Issues_def.jpg")
        PictureBox4.Image = System.Drawing.Image.FromFile("c:\easyselling\solutions_def.jpg")
        PictureBox5.Image = System.Drawing.Image.FromFile("c:\easyselling\outputs_def.jpg")

    End Sub


End Class

⌨️ 快捷键说明

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