Form template for use with visual inheritance : Visual Inheritance « GUI « VB.Net Tutorial






Form template for use with visual inheritance
Imports System.Windows.Forms

public class FormInheritance
   public Shared Sub Main
        Application.Run(New FrmInheritance)
   End Sub
End class


Public Class FrmInheritance
   Inherits 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
   Friend WithEvents lblText As System.Windows.Forms.Label
   Friend WithEvents lblCopyright As System.Windows.Forms.Label
   Friend WithEvents cmdLearn As System.Windows.Forms.Button

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

   '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.lblCopyright = New System.Windows.Forms.Label()
      Me.cmdLearn = New System.Windows.Forms.Button()
      Me.lblText = New System.Windows.Forms.Label()
      Me.SuspendLayout()
      '
      'lblCopyright
      '
      Me.lblCopyright.BackColor = System.Drawing.Color.LightYellow
      Me.lblCopyright.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
      Me.lblCopyright.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
      Me.lblCopyright.ForeColor = System.Drawing.Color.MidnightBlue
      Me.lblCopyright.Location = New System.Drawing.Point(20, 178)
      Me.lblCopyright.Name = "lblCopyright"
      Me.lblCopyright.Size = New System.Drawing.Size(318, 29)
      Me.lblCopyright.TabIndex = 1
      Me.lblCopyright.Text = "Copyright 2002"
      '
      'cmdLearn
      '
      Me.cmdLearn.BackColor = System.Drawing.Color.Snow
      Me.cmdLearn.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
      Me.cmdLearn.ForeColor = System.Drawing.SystemColors.InfoText
      Me.cmdLearn.Location = New System.Drawing.Point(20, 99)
      Me.cmdLearn.Name = "cmdLearn"
      Me.cmdLearn.Size = New System.Drawing.Size(144, 59)
      Me.cmdLearn.TabIndex = 2
      Me.cmdLearn.Text = "Learn More"
      '
      'lblText
      '
      Me.lblText.BackColor = System.Drawing.Color.LightYellow
      Me.lblText.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
      Me.lblText.Font = New System.Drawing.Font("Microsoft Sans Serif", 20.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
      Me.lblText.ForeColor = System.Drawing.Color.MidnightBlue
      Me.lblText.Location = New System.Drawing.Point(20, 20)
      Me.lblText.Name = "lblText"
      Me.lblText.Size = New System.Drawing.Size(318, 59)
      Me.lblText.TabIndex = 0
      Me.lblText.Text = "Text"
      Me.lblText.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
      '
      'FrmInheritance
      '
      Me.AutoScaleBaseSize = New System.Drawing.Size(6, 15)
      Me.BackColor = System.Drawing.SystemColors.ActiveBorder
      Me.ClientSize = New System.Drawing.Size(358, 223)
      Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.cmdLearn, Me.lblCopyright, Me.lblText})
      Me.Name = "FrmInheritance"
      Me.Text = "Visual Inheritance"
      Me.ResumeLayout(False)

   End Sub

#End Region

   ' invoked when user presses Learn More button
   Private Sub cmdLearn_Click(ByVal sender As System.Object, _
      ByVal e As System.EventArgs) Handles cmdLearn.Click

      MessageBox.Show("Message", "Title", MessageBoxButtons.OK, _
         MessageBoxIcon.Information)
   End Sub ' cmdLearn_Click

End Class








14.93.Visual Inheritance
14.93.1.Form template for use with visual inheritanceForm template for use with visual inheritance