Mega Code Archive

 
Categories / VB.Net / GUI
 

Subclass Form

Imports System Imports System.Drawing Imports System.Windows.Forms Imports System.ComponentModel Imports System.Drawing.Drawing2D Imports System.IO Public Class MainClass          Shared Sub Main()         Dim form1 As Form = New Form1         Application.Run(form1)     End Sub End Class Public Class Form1     Inherits Ancestor #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     '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()         Me.SuspendLayout()         '         'Descendent         '         Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14)         Me.ClientSize = New System.Drawing.Size(300, 266)         Me.HeaderText = "HeaderText"         Me.Name = "Descendent"         Me.ResumeLayout(False)     End Sub #End Region     ' Do NOT include the Handles keyword!     Protected Overrides Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)         MessageBox.Show("derived")     End Sub End Class Public Class Ancestor     Inherits System.Windows.Forms.Form #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     '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.     Friend WithEvents Panel1 As System.Windows.Forms.Panel     Friend WithEvents lblHeader As System.Windows.Forms.Label     Friend WithEvents cmdNext As System.Windows.Forms.Button     Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()         Me.Panel1 = New System.Windows.Forms.Panel()         Me.lblHeader = New System.Windows.Forms.Label()         Me.cmdNext = New System.Windows.Forms.Button()         Me.GroupBox1 = New System.Windows.Forms.GroupBox()         Me.Panel1.SuspendLayout()         Me.SuspendLayout()         '         'Panel1         '         Me.Panel1.Anchor = ((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _                     Or System.Windows.Forms.AnchorStyles.Right)         Me.Panel1.BackColor = System.Drawing.Color.White         Me.Panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle         Me.Panel1.Controls.AddRange(New System.Windows.Forms.Control() {Me.lblHeader})         Me.Panel1.Location = New System.Drawing.Point(4, 4)         Me.Panel1.Name = "Panel1"         Me.Panel1.Size = New System.Drawing.Size(292, 68)         Me.Panel1.TabIndex = 0         '         'lblHeader         '         Me.lblHeader.Anchor = ((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _                     Or System.Windows.Forms.AnchorStyles.Right)         Me.lblHeader.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))         Me.lblHeader.Location = New System.Drawing.Point(16, 16)         Me.lblHeader.Name = "lblHeader"         Me.lblHeader.Size = New System.Drawing.Size(262, 28)         Me.lblHeader.TabIndex = 0         Me.lblHeader.Text = "Header Text"         '         'cmdNext         '         Me.cmdNext.Anchor = (System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right)         Me.cmdNext.FlatStyle = System.Windows.Forms.FlatStyle.System         Me.cmdNext.Location = New System.Drawing.Point(232, 232)         Me.cmdNext.Name = "cmdNext"         Me.cmdNext.Size = New System.Drawing.Size(60, 28)         Me.cmdNext.TabIndex = 1         Me.cmdNext.Text = "Next"         '         'GroupBox1         '         Me.GroupBox1.Anchor = ((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _                     Or System.Windows.Forms.AnchorStyles.Right)         Me.GroupBox1.Location = New System.Drawing.Point(8, 224)         Me.GroupBox1.Name = "GroupBox1"         Me.GroupBox1.Size = New System.Drawing.Size(284, 4)         Me.GroupBox1.TabIndex = 2         Me.GroupBox1.TabStop = False         Me.GroupBox1.Text = "GroupBox1"         '         'Ancestor         '         Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14)         Me.ClientSize = New System.Drawing.Size(300, 266)         Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.GroupBox1, Me.cmdNext, Me.Panel1})         Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))         Me.Name = "Ancestor"         Me.Text = "Ancestor"         Me.Panel1.ResumeLayout(False)         Me.ResumeLayout(False)     End Sub #End Region     Protected Overridable Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdNext.Click     End Sub     Public Property HeaderText() As String         Get             Return lblHeader.Text         End Get         Set(ByVal Value As String)             lblHeader.Text = Value         End Set     End Property      End Class