buttonmenu.vbold

来自「《ViSUAL BASIC》设计模式」· VBOLD 代码 · 共 73 行

VBOLD
73
字号
Imports System
Imports System.ComponentModel
Imports System.Drawing
Imports System.Drawing.Color
Imports System.WinForms

 
    Public Class ButtonMenu
        Inherits System.WinForms.Form

        'Required by the Win Forms Designer   
        Private components As System.ComponentModel.Container
        Private MainMenu As System.WinForms.MainMenu
                Private RedButton As System.WinForms.Button
    
        Public Sub New()
           MyBase.New
    
           'This call is required by the Win Forms Designer.
           InitializeComponent
    
           ' TODO: Add any constructor code after InitializeComponent call

        End Sub

        'Clean up any resources being used
        Overrides Public Sub Dispose()
            MyBase.Dispose
            components.Dispose
        End Sub 

        'The main entry point for the application
        Shared Sub Main()
            System.WinForms.Application.Run(New ButtonMenu())
        End Sub

        'NOTE: The following procedure is required by the Win Forms Designer
        'Do not modify it.
        Private Sub InitializeComponent() 
            Me.components = New System.ComponentModel.Container
            Me.MainMenu = New System.WinForms.MainMenu
            Dim miFile As MenuItem = mainMenu.MenuItems.Add("&File")
        '	    miFile.MenuItems.Add(new FileOpen(new EventHandler(AddressOf CommandHandler)))
        '           miFile.MenuItems.Add(new ExitMenu( new EventHandler(AddressOf CommandHandler), Me) )

        '    Me.RedButton = New RedButton( Me, new EventHandler(AddressOf CommandHandler))

        '            RedButton.Location = New System.Drawing.Point(80, 64)
        '            RedButton.Size = New System.Drawing.Size(88, 32)
        '            RedButton.TabIndex = 0
        '            RedButton.Text = "Red"
            

            Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
            Me.Text = "Button Menu"
            
            Me.Menu = MainMenu
            Me.ClientSize = New System.Drawing.Size(272, 165)

        '    Me.Controls.Add(RedButton)

        End Sub
        
Private Sub CommandHandler(sender As object, e As System.EventArgs)      
 Dim cmd as Command

 cmd = CType(sender, Command)
 cmd.Execute
 end sub        
End Class


⌨️ 快捷键说明

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