VB.Net/GUI/GUI Basics

Материал из VB Эксперт
Перейти к: навигация, поиск

Hand made GUI class

Imports System
Imports System.Windows.Forms
Public Class MainClass
    Shared Sub Main(  )
        Application.Run(New HandDrawnClass() )
    End Sub
   
End Class
    Public Class HandDrawnClass
       Inherits Form
       Private lblOutput As System.Windows.Forms.Label
       Private btnCancel As System.Windows.Forms.Button

       Public Sub New(  )
          Me.lblOutput = New System.Windows.Forms.Label(  )
          Me.btnCancel = New System.Windows.Forms.Button(  )
          Me.Text = "Hello World"
          lblOutput.Location = New System.Drawing.Point(16, 24)
          lblOutput.Text = "Hello World!"
          lblOutput.Size = New System.Drawing.Size(216, 24)
          btnCancel.Location = New System.Drawing.Point(150, 200)
          btnCancel.Size = New System.Drawing.Size(112, 32)
          btnCancel.Text = "&Cancel"
          AddHandler btnCancel.Click, AddressOf Me.btnCancel_Click
          Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
          Me.ClientSize = New System.Drawing.Size(300, 300)
          Me.Controls.Add(Me.btnCancel)
          Me.Controls.Add(Me.lblOutput)
       End Sub "New

       Protected Sub btnCancel_Click( _
          sender As Object, e As System.EventArgs)
          Application.Exit(  )
       End Sub
    End Class