VB.Net/GUI/Frame Special — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 19:40, 26 мая 2010
Содержание
Irregular shape form
<source lang="vbnet"> Imports System Imports System.Drawing Imports System.Windows.Forms Imports System.ruponentModel 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 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.ruponentModel.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 Button1 As System.Windows.Forms.Button <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.Button1 = New System.Windows.Forms.Button() Me.SuspendLayout() " "Button1 " Me.Button1.Location = New System.Drawing.Point(20, 16) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(136, 36) Me.Button1.TabIndex = 0 Me.Button1.Text = "Button1" " "Form1 " Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(320, 226) Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1}) Me.Name = "Form1" Me.Text = "Shaped Form" Me.ResumeLayout(False) End Sub
- End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim Path As New GraphicsPath() Path.AddEllipse(0, 0, Me.Width \ 2, Me.Height \ 2) Me.Region = New Region(Path) End Sub
End Class
</source>
Scrollable Form
<source lang="vbnet"> Imports System Imports System.Collections Imports System.Data Imports System.IO Imports System.Xml.Serialization Imports System.Windows.Forms Imports System.Drawing Imports System.Drawing.Drawing2D Imports System.Drawing.Text Imports System.Drawing.Printing
Public Class MainClass
Shared Sub Main() Dim form1 As Form = New Form1() Application.Run(form1) End Sub
End Class
Public Class Form1
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 Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox "Required by the Windows Form Designer Private components As System.ruponentModel.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.PictureBox1 = New System.Windows.Forms.PictureBox() Me.SuspendLayout() " "PictureBox1 " Me.PictureBox1.Location = New System.Drawing.Point(48, 64) Me.PictureBox1.Name = "PictureBox1" Me.PictureBox1.Size = New System.Drawing.Size(176, 80) Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize Me.PictureBox1.TabIndex = 0 Me.PictureBox1.TabStop = False " "Form1 " Me.AutoScaleBaseSize = New System.Drawing.Size(6, 15) Me.ClientSize = New System.Drawing.Size(472, 268) Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.PictureBox1}) Me.Name = "Form1" Me.Text = "A Scrolling Form" Me.ResumeLayout(False) End Sub
- End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.AutoScroll = True Me.VScroll = True Me.HScroll = True Dim aBigBox As Rectangle = Rectangle.Inflate(Me.ClientRectangle, 6, 6) PictureBox1.Bounds = aBigBox PictureBox1.Image = Image.FromFile("figure2.bmp") End Sub
End Class
</source>
Scrollable Form Demo
<source lang="vbnet"> Imports System Imports System.Drawing Imports System.Windows.Forms Imports System.ruponentModel 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 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.ruponentModel.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 Button1 As System.Windows.Forms.Button Friend WithEvents Button2 As System.Windows.Forms.Button Friend WithEvents Button3 As System.Windows.Forms.Button Friend WithEvents Button4 As System.Windows.Forms.Button Friend WithEvents Button5 As System.Windows.Forms.Button Friend WithEvents Button6 As System.Windows.Forms.Button <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.Panel1 = New System.Windows.Forms.Panel() Me.Button6 = New System.Windows.Forms.Button() Me.Button5 = New System.Windows.Forms.Button() Me.Button4 = New System.Windows.Forms.Button() Me.Button3 = New System.Windows.Forms.Button() Me.Button2 = New System.Windows.Forms.Button() Me.Button1 = New System.Windows.Forms.Button() Me.Panel1.SuspendLayout() Me.SuspendLayout() " "Panel1 " Me.Panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D Me.Panel1.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button6, Me.Button5, Me.Button4, Me.Button3, Me.Button2, Me.Button1}) Me.Panel1.Location = New System.Drawing.Point(8, 8) Me.Panel1.Name = "Panel1" Me.Panel1.Size = New System.Drawing.Size(260, 232) Me.Panel1.TabIndex = 0 " "Button6 " Me.Button6.FlatStyle = System.Windows.Forms.FlatStyle.System Me.Button6.Location = New System.Drawing.Point(16, 180) Me.Button6.Name = "Button6" Me.Button6.Size = New System.Drawing.Size(168, 24) Me.Button6.TabIndex = 5 Me.Button6.Text = "Button6" " "Button5 " Me.Button5.FlatStyle = System.Windows.Forms.FlatStyle.System Me.Button5.Location = New System.Drawing.Point(16, 148) Me.Button5.Name = "Button5" Me.Button5.Size = New System.Drawing.Size(168, 24) Me.Button5.TabIndex = 4 Me.Button5.Text = "Button5" " "Button4 " Me.Button4.FlatStyle = System.Windows.Forms.FlatStyle.System Me.Button4.Location = New System.Drawing.Point(16, 116) Me.Button4.Name = "Button4" Me.Button4.Size = New System.Drawing.Size(168, 24) Me.Button4.TabIndex = 3 Me.Button4.Text = "Button4" " "Button3 " Me.Button3.FlatStyle = System.Windows.Forms.FlatStyle.System Me.Button3.Location = New System.Drawing.Point(16, 84) Me.Button3.Name = "Button3" Me.Button3.Size = New System.Drawing.Size(168, 24) Me.Button3.TabIndex = 2 Me.Button3.Text = "Button3" " "Button2 " Me.Button2.FlatStyle = System.Windows.Forms.FlatStyle.System Me.Button2.Location = New System.Drawing.Point(16, 52) Me.Button2.Name = "Button2" Me.Button2.Size = New System.Drawing.Size(168, 24) Me.Button2.TabIndex = 1 Me.Button2.Text = "Button2" " "Button1 " Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.System Me.Button1.Location = New System.Drawing.Point(16, 20) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(168, 24) Me.Button1.TabIndex = 0 Me.Button1.Text = "Button1" " "ScrollableForm " Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) Me.AutoScroll = True Me.ClientSize = New System.Drawing.Size(224, 147) Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Panel1}) Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Name = "ScrollableForm" Me.Text = "Scrollable Form" Me.Panel1.ResumeLayout(False) Me.ResumeLayout(False) End Sub
- End Region
Private Sub ScrollableForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Refresh() End Sub
End Class
</source>
Semi Transparent Frame: Me.Opacity = 0.66
<source lang="vbnet"> Imports System Imports System.Runtime.InteropServices Imports System.Drawing Imports System.ruponentModel Imports System.Windows.Forms Imports System.IO Public Class MainClass
Shared Sub Main(ByVal args As String()) Dim myform As Form = New Form1() Application.Run(myform) End Sub
End Class
<Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()> _ Partial Public Class Form1
Inherits System.Windows.Forms.Form "Form overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) If disposing AndAlso components IsNot Nothing Then components.Dispose() End If MyBase.Dispose(disposing) End Sub "Required by the Windows Form Designer Private components As System.ruponentModel.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() " "Form1 " Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(292, 273) Me.Name = "Form1" Me.Opacity = 0.66 Me.Text = "SemiTransparent" Me.ResumeLayout(False) End Sub
End Class
</source>
Set Form Opacity to 1%
<source lang="vbnet"> Imports System Imports System.Drawing Imports System.Windows.Forms Imports System.ruponentModel 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 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 Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox Friend WithEvents cmdApply As System.Windows.Forms.Button Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents udOpacity As System.Windows.Forms.NumericUpDown "Required by the Windows Form Designer Private components As System.ruponentModel.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.GroupBox1 = New System.Windows.Forms.GroupBox() Me.cmdApply = New System.Windows.Forms.Button() Me.udOpacity = New System.Windows.Forms.NumericUpDown() Me.Label1 = New System.Windows.Forms.Label() Me.GroupBox1.SuspendLayout() CType(Me.udOpacity, System.ruponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() " "GroupBox1 " Me.GroupBox1.Controls.AddRange(New System.Windows.Forms.Control() {Me.cmdApply, Me.udOpacity, Me.Label1}) Me.GroupBox1.Location = New System.Drawing.Point(12, 20) Me.GroupBox1.Name = "GroupBox1" Me.GroupBox1.Size = New System.Drawing.Size(268, 116) Me.GroupBox1.TabIndex = 3 Me.GroupBox1.TabStop = False " "cmdApply " Me.cmdApply.Location = New System.Drawing.Point(172, 64) Me.cmdApply.Name = "cmdApply" Me.cmdApply.Size = New System.Drawing.Size(80, 24) Me.cmdApply.TabIndex = 5 Me.cmdApply.Text = "Apply" " "udOpacity " Me.udOpacity.Increment = New Decimal(New Integer() {5, 0, 0, 0}) Me.udOpacity.Location = New System.Drawing.Point(88, 32) Me.udOpacity.Name = "udOpacity" Me.udOpacity.Size = New System.Drawing.Size(48, 21) Me.udOpacity.TabIndex = 4 Me.udOpacity.Value = New Decimal(New Integer() {50, 0, 0, 0}) " "Label1 " Me.Label1.Location = New System.Drawing.Point(20, 36) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(56, 16) Me.Label1.TabIndex = 3 Me.Label1.Text = "Opacity:" " "Transparent " Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) Me.ClientSize = New System.Drawing.Size(292, 266) Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.GroupBox1}) Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Name = "Transparent" Me.Opacity = 0.5 Me.Text = "A Transparent Form" Me.GroupBox1.ResumeLayout(False) CType(Me.udOpacity, System.ruponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub
- End Region
Private Sub cmdApply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdApply.Click Me.Opacity = udOpacity.Value / 100 End Sub
End Class
</source>
Transparent by Setting Me.Region
<source lang="vbnet"> Imports System.Drawing.Drawing2D Imports System Imports System.Drawing.Text Imports System.Drawing Imports System.Windows.Forms Imports System.Math Public Class MainClass
Shared Sub Main() Dim form1 As Form = New Form1() Application.Run(form1) End Sub
End Class
Public Class Form1
Private Sub Form1_Paint(ByVal sender As Object, _ ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint Dim txt As String = "www.vbex.ru" Dim graphics_path As New GraphicsPath graphics_path.AddString(txt, _ New FontFamily("Times New Roman"), _ FontStyle.Bold, 150, _ New Point(0, 0), _ New StringFormat) Me.Region = New Region(graphics_path) Dim origin As Point = Me.PointToScreen(New Point(0, 0)) e.Graphics.SmoothingMode = SmoothingMode.AntiAlias e.Graphics.TranslateTransform(Me.Left - origin.X, Me.Top - origin.Y) e.Graphics.DrawPath(New Pen(Color.Black, 5), graphics_path) End Sub
End Class
<Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()> _
Partial Public Class Form1
Inherits System.Windows.Forms.Form "Form overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing AndAlso components IsNot Nothing Then components.Dispose() End If MyBase.Dispose(disposing) End Sub "Required by the Windows Form Designer Private components As System.ruponentModel.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() " "Form1 " Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(800, 400) Me.Name = "Form1" Me.Text = "TransformArrow" Me.ResumeLayout(False) End Sub
End Class
</source>
Transparent Form: Holes
<source lang="vbnet"> Imports System Imports System.Drawing Imports System.Windows.Forms Imports System.ruponentModel 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 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 Friend WithEvents PictureBox3 As System.Windows.Forms.PictureBox "Required by the Windows Form Designer Private components As System.ruponentModel.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 PictureBox1 As System.Windows.Forms.PictureBox Friend WithEvents PictureBox2 As System.Windows.Forms.PictureBox Friend WithEvents PictureBox4 As System.Windows.Forms.PictureBox <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.PictureBox3 = New System.Windows.Forms.PictureBox() Me.PictureBox1 = New System.Windows.Forms.PictureBox() Me.PictureBox2 = New System.Windows.Forms.PictureBox() Me.PictureBox4 = New System.Windows.Forms.PictureBox() Me.SuspendLayout() " "PictureBox3 " Me.PictureBox3.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(128, Byte), CType(128, Byte)) Me.PictureBox3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D Me.PictureBox3.Location = New System.Drawing.Point(28, 24) Me.PictureBox3.Name = "PictureBox3" Me.PictureBox3.Size = New System.Drawing.Size(76, 76) Me.PictureBox3.TabIndex = 3 Me.PictureBox3.TabStop = False " "PictureBox1 " Me.PictureBox1.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(128, Byte), CType(128, Byte)) Me.PictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D Me.PictureBox1.Location = New System.Drawing.Point(124, 24) Me.PictureBox1.Name = "PictureBox1" Me.PictureBox1.Size = New System.Drawing.Size(76, 76) Me.PictureBox1.TabIndex = 4 Me.PictureBox1.TabStop = False " "PictureBox2 " Me.PictureBox2.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(128, Byte), CType(128, Byte)) Me.PictureBox2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D Me.PictureBox2.Location = New System.Drawing.Point(28, 116) Me.PictureBox2.Name = "PictureBox2" Me.PictureBox2.Size = New System.Drawing.Size(76, 76) Me.PictureBox2.TabIndex = 5 Me.PictureBox2.TabStop = False " "PictureBox4 " Me.PictureBox4.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(128, Byte), CType(128, Byte)) Me.PictureBox4.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D Me.PictureBox4.Location = New System.Drawing.Point(124, 116) Me.PictureBox4.Name = "PictureBox4" Me.PictureBox4.Size = New System.Drawing.Size(76, 76) Me.PictureBox4.TabIndex = 6 Me.PictureBox4.TabStop = False " "Holes " Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(232, 234) Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.PictureBox4, Me.PictureBox2, Me.PictureBox1, Me.PictureBox3}) Me.Name = "Holes" Me.Text = "A Form With Holes" Me.TransparencyKey = System.Drawing.Color.FromArgb(CType(255, Byte), CType(128, Byte), CType(128, Byte)) Me.ResumeLayout(False) End Sub
- End Region
End Class
</source>
Transparent Frame
<source lang="vbnet"> Imports System Imports System.ruponentModel Imports System.Windows.Forms
Public Class MainClass
Shared Sub Main(ByVal args As String()) Dim myform As Form = New Form1() Application.Run(myform) End Sub
End Class Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load TransparencyKey = BackColor End Sub
End Class <Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()> _ Partial Public Class Form1
Inherits System.Windows.Forms.Form "Form overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) If disposing AndAlso components IsNot Nothing Then components.Dispose() End If MyBase.Dispose(disposing) End Sub "Required by the Windows Form Designer Private components As System.ruponentModel.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.Button1 = New System.Windows.Forms.Button Me.Button2 = New System.Windows.Forms.Button Me.Button3 = New System.Windows.Forms.Button Me.Label1 = New System.Windows.Forms.Label Me.TextBox1 = New System.Windows.Forms.TextBox Me.TextBox2 = New System.Windows.Forms.TextBox Me.Label2 = New System.Windows.Forms.Label Me.TextBox3 = New System.Windows.Forms.TextBox Me.Label3 = New System.Windows.Forms.Label Me.TextBox4 = New System.Windows.Forms.TextBox Me.Label4 = New System.Windows.Forms.Label Me.ruboBox1 = New System.Windows.Forms.ruboBox Me.Label5 = New System.Windows.Forms.Label Me.TextBox5 = New System.Windows.Forms.TextBox Me.Label6 = New System.Windows.Forms.Label Me.SuspendLayout() " "Button1 " Me.Button1.Location = New System.Drawing.Point(8, 8) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(75, 23) Me.Button1.TabIndex = 0 Me.Button1.Text = "Button1" Me.Button1.UseVisualStyleBackColor = True " "Button2 " Me.Button2.Location = New System.Drawing.Point(88, 8) Me.Button2.Name = "Button2" Me.Button2.Size = New System.Drawing.Size(75, 23) Me.Button2.TabIndex = 1 Me.Button2.Text = "Button2" Me.Button2.UseVisualStyleBackColor = True " "Button3 " Me.Button3.Location = New System.Drawing.Point(168, 8) Me.Button3.Name = "Button3" Me.Button3.Size = New System.Drawing.Size(75, 23) Me.Button3.TabIndex = 2 Me.Button3.Text = "Button3" Me.Button3.UseVisualStyleBackColor = True " "Label1 " Me.Label1.AutoSize = True Me.Label1.Location = New System.Drawing.Point(8, 56) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(57, 13) Me.Label1.TabIndex = 3 Me.Label1.Text = "First Name" " "TextBox1 " Me.TextBox1.Location = New System.Drawing.Point(80, 56) Me.TextBox1.Name = "TextBox1" Me.TextBox1.Size = New System.Drawing.Size(168, 20) Me.TextBox1.TabIndex = 4 Me.TextBox1.Text = "Joe" " "TextBox2 " Me.TextBox2.Location = New System.Drawing.Point(80, 80) Me.TextBox2.Name = "TextBox2" Me.TextBox2.Size = New System.Drawing.Size(168, 20) Me.TextBox2.TabIndex = 6 Me.TextBox2.Text = "Yin" " "Label2 " Me.Label2.AutoSize = True Me.Label2.Location = New System.Drawing.Point(8, 80) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(58, 13) Me.Label2.TabIndex = 5 Me.Label2.Text = "Last Name" " "TextBox3 " Me.TextBox3.Location = New System.Drawing.Point(80, 128) Me.TextBox3.Name = "TextBox3" Me.TextBox3.Size = New System.Drawing.Size(168, 20) Me.TextBox3.TabIndex = 10 Me.TextBox3.Text = "Text Field" " "Label3 " Me.Label3.AutoSize = True Me.Label3.Location = New System.Drawing.Point(8, 128) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(24, 13) Me.Label3.TabIndex = 9 Me.Label3.Text = "City" " "TextBox4 " Me.TextBox4.Location = New System.Drawing.Point(80, 104) Me.TextBox4.Name = "TextBox4" Me.TextBox4.Size = New System.Drawing.Size(168, 20) Me.TextBox4.TabIndex = 8 Me.TextBox4.Text = "Address" " "Label4 " Me.Label4.AutoSize = True Me.Label4.Location = New System.Drawing.Point(8, 104) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(35, 13) Me.Label4.TabIndex = 7 Me.Label4.Text = "Street" " "ComboBox1 " Me.ruboBox1.FormattingEnabled = True Me.ruboBox1.Location = New System.Drawing.Point(80, 152) Me.ruboBox1.Name = "ComboBox1" Me.ruboBox1.Size = New System.Drawing.Size(48, 21) Me.ruboBox1.TabIndex = 11 Me.ruboBox1.Text = "HI" " "Label5 " Me.Label5.AutoSize = True Me.Label5.Location = New System.Drawing.Point(8, 152) Me.Label5.Name = "Label5" Me.Label5.Size = New System.Drawing.Size(32, 13) Me.Label5.TabIndex = 12 Me.Label5.Text = "State" " "TextBox5 " Me.TextBox5.Location = New System.Drawing.Point(176, 152) Me.TextBox5.Name = "TextBox5" Me.TextBox5.Size = New System.Drawing.Size(72, 20) Me.TextBox5.TabIndex = 14 Me.TextBox5.Text = "12345-6789" " "Label6 " Me.Label6.AutoSize = True Me.Label6.Location = New System.Drawing.Point(144, 152) Me.Label6.Name = "Label6" Me.Label6.Size = New System.Drawing.Size(22, 13) Me.Label6.TabIndex = 13 Me.Label6.Text = "Zip" " "Form1 " Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(257, 181) Me.Controls.Add(Me.TextBox5) Me.Controls.Add(Me.Label6) Me.Controls.Add(Me.Label5) Me.Controls.Add(Me.ruboBox1) Me.Controls.Add(Me.TextBox3) Me.Controls.Add(Me.Label3) Me.Controls.Add(Me.TextBox4) Me.Controls.Add(Me.Label4) Me.Controls.Add(Me.TextBox2) Me.Controls.Add(Me.Label2) Me.Controls.Add(Me.TextBox1) Me.Controls.Add(Me.Label1) Me.Controls.Add(Me.Button3) Me.Controls.Add(Me.Button2) Me.Controls.Add(Me.Button1) Me.Name = "Form1" Me.Text = "GhostForm" Me.ResumeLayout(False) Me.PerformLayout() End Sub Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents Button2 As System.Windows.Forms.Button Friend WithEvents Button3 As System.Windows.Forms.Button Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents TextBox1 As System.Windows.Forms.TextBox Friend WithEvents TextBox2 As System.Windows.Forms.TextBox Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents TextBox3 As System.Windows.Forms.TextBox Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents TextBox4 As System.Windows.Forms.TextBox Friend WithEvents Label4 As System.Windows.Forms.Label Friend WithEvents ComboBox1 As System.Windows.Forms.ruboBox Friend WithEvents Label5 As System.Windows.Forms.Label Friend WithEvents TextBox5 As System.Windows.Forms.TextBox Friend WithEvents Label6 As System.Windows.Forms.Label
End Class
</source>
Transparent Frame Demo
<source lang="vbnet"> Imports System Imports System.Runtime.InteropServices Imports System.Drawing Imports System.ruponentModel Imports System.Windows.Forms
Public Class MainClass
Shared Sub Main(ByVal args As String()) Dim myform As Form = New Form1() Application.Run(myform) End Sub
End Class Public Class Form1
" Make the form"s background transparent. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load TransparencyKey = BackColor Label1.BackColor = TransparencyKey End Sub Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint Dim thick_pen As New Pen(Color.Black, 10) Dim rect As New Rectangle(e.ClipRectangle.X + 10, e.ClipRectangle.Y + 10, _ e.ClipRectangle.Width - 20, e.ClipRectangle.Height - 20) e.Graphics.DrawRectangle(thick_pen, rect) thick_pen.Dispose() End Sub
End Class
<Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()> _ Partial Public Class Form1
Inherits System.Windows.Forms.Form "Form overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) If disposing AndAlso components IsNot Nothing Then components.Dispose() End If MyBase.Dispose(disposing) End Sub "Required by the Windows Form Designer Private components As System.ruponentModel.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.Label1 = New System.Windows.Forms.Label Me.SuspendLayout() " "Label1 " Me.Label1.AutoSize = True Me.Label1.BackColor = System.Drawing.SystemColors.Control Me.Label1.Font = New System.Drawing.Font("Forte", 48.0!, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label1.Location = New System.Drawing.Point(48, 56) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(169, 70) Me.Label1.TabIndex = 0 Me.Label1.Text = "www.vbex.ru" Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter " "Form1 " Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.BackColor = System.Drawing.Color.Red Me.ClientSize = New System.Drawing.Size(274, 187) Me.Controls.Add(Me.Label1) Me.Name = "Form1" Me.Text = "Form1" Me.ResumeLayout(False) Me.PerformLayout() End Sub Friend WithEvents Label1 As System.Windows.Forms.Label
End Class
</source>