Gewusst wie: Erstellen von in der Größe veränderbaren Windows Forms für die Dateneingabe
Ein gutes Layout zeichnet sich dadurch aus, dass es auf Änderungen der Größe des übergeordneten Formulars angemessen reagiert. Sie können das Layout des Formulars mit dem TableLayoutPanel-Steuerelement so einrichten, dass die Steuerelemente konsistent angepasst und positioniert werden, wenn sich die Größe des Formulars ändert. Das TableLayoutPanel-Steuerelement ist zudem hilfreich, wenn Änderungen am Inhalt der Steuerelemente zu Änderungen am Layout führen. Der in dieser Prozedur beschriebene Prozess kann innerhalb der Visual Studio-Umgebung erfolgen. Weitere Informationen finden Sie unter Exemplarische Vorgehensweise: Erstellen eines in der Größe veränderbaren Windows Forms für die Dateneingabe und Exemplarische Vorgehensweise: Erstellen eines in der Größe veränderbaren Windows Forms für die Dateneingabe und Exemplarische Vorgehensweise: Erstellen eines in der Größe veränderbaren Windows Forms für die Dateneingabe und Exemplarische Vorgehensweise: Erstellen eines in der Größe veränderbaren Windows Forms für die Dateneingabe und Exemplarische Vorgehensweise: Erstellen eines in der Größe veränderbaren Windows Forms für die Dateneingabe.
Beispiel
Im folgenden Beispiel wird gezeigt, wie Sie mit einem TableLayoutPanel-Steuerelement ein Layout erstellen, das angemessen reagiert, wenn der Benutzer die Größe des Formulars ändert. Darüber hinaus zeigt es ein Layout, das für Lokalisierung gut geeignet ist.
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
' This form demonstrates how to build a form layout that adjusts well
' when the user resizes the form. It also demonstrates a layout that
' responds well to localization.
Class BasicDataEntryForm
Inherits System.Windows.Forms.Form
Public Sub New()
InitializeComponent()
End Sub
Private components As System.ComponentModel.IContainer = Nothing
Protected Overrides Sub Dispose(disposing As Boolean)
If disposing AndAlso (components IsNot Nothing) Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
Public Overrides Function ToString() As String
Return "Basic Data Entry Form"
End Function
Private Sub okBtn_Click(ByVal sender As Object, ByVal e As EventArgs) Handles okBtn.Click
Me.Close()
End Sub
Private Sub cancelBtn_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cancelBtn.Click
Me.Close()
End Sub
Private Sub InitializeComponent()
Me.tableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel
Me.label1 = New System.Windows.Forms.Label
Me.label2 = New System.Windows.Forms.Label
Me.label3 = New System.Windows.Forms.Label
Me.label4 = New System.Windows.Forms.Label
Me.label5 = New System.Windows.Forms.Label
Me.label6 = New System.Windows.Forms.Label
Me.label9 = New System.Windows.Forms.Label
Me.textBox2 = New System.Windows.Forms.TextBox
Me.textBox3 = New System.Windows.Forms.TextBox
Me.textBox4 = New System.Windows.Forms.TextBox
Me.textBox5 = New System.Windows.Forms.TextBox
Me.maskedTextBox1 = New System.Windows.Forms.MaskedTextBox
Me.maskedTextBox2 = New System.Windows.Forms.MaskedTextBox
Me.comboBox1 = New System.Windows.Forms.ComboBox
Me.textBox1 = New System.Windows.Forms.TextBox
Me.label7 = New System.Windows.Forms.Label
Me.label8 = New System.Windows.Forms.Label
Me.richTextBox1 = New System.Windows.Forms.RichTextBox
Me.cancelBtn = New System.Windows.Forms.Button
Me.okBtn = New System.Windows.Forms.Button
Me.tableLayoutPanel1.SuspendLayout()
Me.SuspendLayout()
'
'tableLayoutPanel1
'
Me.tableLayoutPanel1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.tableLayoutPanel1.ColumnCount = 4
Me.tableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle)
Me.tableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!))
Me.tableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle)
Me.tableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!))
Me.tableLayoutPanel1.Controls.Add(Me.label1, 0, 0)
Me.tableLayoutPanel1.Controls.Add(Me.label2, 2, 0)
Me.tableLayoutPanel1.Controls.Add(Me.label3, 0, 1)
Me.tableLayoutPanel1.Controls.Add(Me.label4, 0, 2)
Me.tableLayoutPanel1.Controls.Add(Me.label5, 0, 3)
Me.tableLayoutPanel1.Controls.Add(Me.label6, 2, 3)
Me.tableLayoutPanel1.Controls.Add(Me.label9, 2, 4)
Me.tableLayoutPanel1.Controls.Add(Me.textBox2, 1, 1)
Me.tableLayoutPanel1.Controls.Add(Me.textBox3, 1, 2)
Me.tableLayoutPanel1.Controls.Add(Me.textBox4, 1, 3)
Me.tableLayoutPanel1.Controls.Add(Me.textBox5, 3, 0)
Me.tableLayoutPanel1.Controls.Add(Me.maskedTextBox1, 1, 4)
Me.tableLayoutPanel1.Controls.Add(Me.maskedTextBox2, 3, 4)
Me.tableLayoutPanel1.Controls.Add(Me.comboBox1, 3, 3)
Me.tableLayoutPanel1.Controls.Add(Me.textBox1, 1, 0)
Me.tableLayoutPanel1.Controls.Add(Me.label7, 0, 5)
Me.tableLayoutPanel1.Controls.Add(Me.label8, 0, 4)
Me.tableLayoutPanel1.Controls.Add(Me.richTextBox1, 1, 5)
Me.tableLayoutPanel1.Location = New System.Drawing.Point(13, 13)
Me.tableLayoutPanel1.Name = "tableLayoutPanel1"
Me.tableLayoutPanel1.RowCount = 6
Me.tableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!))
Me.tableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!))
Me.tableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!))
Me.tableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!))
Me.tableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!))
Me.tableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 80.0!))
Me.tableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20.0!))
Me.tableLayoutPanel1.Size = New System.Drawing.Size(623, 286)
Me.tableLayoutPanel1.TabIndex = 0
'
'label1
'
Me.label1.Anchor = System.Windows.Forms.AnchorStyles.Right
Me.label1.AutoSize = True
Me.label1.Location = New System.Drawing.Point(3, 7)
Me.label1.Name = "label1"
Me.label1.Size = New System.Drawing.Size(59, 14)
Me.label1.TabIndex = 20
Me.label1.Text = "First Name"
'
'label2
'
Me.label2.Anchor = System.Windows.Forms.AnchorStyles.Right
Me.label2.AutoSize = True
Me.label2.Location = New System.Drawing.Point(323, 7)
Me.label2.Name = "label2"
Me.label2.Size = New System.Drawing.Size(59, 14)
Me.label2.TabIndex = 21
Me.label2.Text = "Last Name"
'
'label3
'
Me.label3.Anchor = System.Windows.Forms.AnchorStyles.Right
Me.label3.AutoSize = True
Me.label3.Location = New System.Drawing.Point(10, 35)
Me.label3.Name = "label3"
Me.label3.Size = New System.Drawing.Size(52, 14)
Me.label3.TabIndex = 22
Me.label3.Text = "Address1"
'
'label4
'
Me.label4.Anchor = System.Windows.Forms.AnchorStyles.Right
Me.label4.AutoSize = True
Me.label4.Location = New System.Drawing.Point(7, 63)
Me.label4.Name = "label4"
Me.label4.Size = New System.Drawing.Size(55, 14)
Me.label4.TabIndex = 23
Me.label4.Text = "Address 2"
'
'label5
'
Me.label5.Anchor = System.Windows.Forms.AnchorStyles.Right
Me.label5.AutoSize = True
Me.label5.Location = New System.Drawing.Point(38, 91)
Me.label5.Name = "label5"
Me.label5.Size = New System.Drawing.Size(24, 14)
Me.label5.TabIndex = 24
Me.label5.Text = "City"
'
'label6
'
Me.label6.Anchor = System.Windows.Forms.AnchorStyles.Right
Me.label6.AutoSize = True
Me.label6.Location = New System.Drawing.Point(351, 91)
Me.label6.Name = "label6"
Me.label6.Size = New System.Drawing.Size(31, 14)
Me.label6.TabIndex = 25
Me.label6.Text = "State"
'
'label9
'
Me.label9.Anchor = System.Windows.Forms.AnchorStyles.Right
Me.label9.AutoSize = True
Me.label9.Location = New System.Drawing.Point(326, 119)
Me.label9.Name = "label9"
Me.label9.Size = New System.Drawing.Size(56, 14)
Me.label9.TabIndex = 33
Me.label9.Text = "Phone (H)"
'
'textBox2
'
Me.textBox2.Anchor = CType((System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.tableLayoutPanel1.SetColumnSpan(Me.textBox2, 3)
Me.textBox2.Location = New System.Drawing.Point(68, 32)
Me.textBox2.Name = "textBox2"
Me.textBox2.Size = New System.Drawing.Size(552, 20)
Me.textBox2.TabIndex = 2
'
'textBox3
'
Me.textBox3.Anchor = CType((System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.tableLayoutPanel1.SetColumnSpan(Me.textBox3, 3)
Me.textBox3.Location = New System.Drawing.Point(68, 60)
Me.textBox3.Name = "textBox3"
Me.textBox3.Size = New System.Drawing.Size(552, 20)
Me.textBox3.TabIndex = 3
'
'textBox4
'
Me.textBox4.Anchor = CType((System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.textBox4.Location = New System.Drawing.Point(68, 88)
Me.textBox4.Name = "textBox4"
Me.textBox4.Size = New System.Drawing.Size(249, 20)
Me.textBox4.TabIndex = 4
'
'textBox5
'
Me.textBox5.Anchor = CType((System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.textBox5.Location = New System.Drawing.Point(388, 4)
Me.textBox5.Name = "textBox5"
Me.textBox5.Size = New System.Drawing.Size(232, 20)
Me.textBox5.TabIndex = 1
'
'maskedTextBox1
'
Me.maskedTextBox1.Anchor = System.Windows.Forms.AnchorStyles.Left
Me.maskedTextBox1.Location = New System.Drawing.Point(68, 116)
Me.maskedTextBox1.Mask = "(999)000-0000"
Me.maskedTextBox1.Name = "maskedTextBox1"
Me.maskedTextBox1.TabIndex = 6
'
'maskedTextBox2
'
Me.maskedTextBox2.Anchor = System.Windows.Forms.AnchorStyles.Left
Me.maskedTextBox2.Location = New System.Drawing.Point(388, 116)
Me.maskedTextBox2.Mask = "(999)000-0000"
Me.maskedTextBox2.Name = "maskedTextBox2"
Me.maskedTextBox2.TabIndex = 7
'
'comboBox1
'
Me.comboBox1.Anchor = System.Windows.Forms.AnchorStyles.Left
Me.comboBox1.FormattingEnabled = True
Me.comboBox1.Items.AddRange(New Object() {"AK - Alaska", "WA - Washington"})
Me.comboBox1.Location = New System.Drawing.Point(388, 87)
Me.comboBox1.Name = "comboBox1"
Me.comboBox1.Size = New System.Drawing.Size(100, 21)
Me.comboBox1.TabIndex = 5
'
'textBox1
'
Me.textBox1.Anchor = CType((System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.textBox1.Location = New System.Drawing.Point(68, 4)
Me.textBox1.Name = "textBox1"
Me.textBox1.Size = New System.Drawing.Size(249, 20)
Me.textBox1.TabIndex = 0
'
'label7
'
Me.label7.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.label7.AutoSize = True
Me.label7.Location = New System.Drawing.Point(28, 143)
Me.label7.Name = "label7"
Me.label7.Size = New System.Drawing.Size(34, 14)
Me.label7.TabIndex = 26
Me.label7.Text = "Notes"
'
'label8
'
Me.label8.Anchor = System.Windows.Forms.AnchorStyles.Right
Me.label8.AutoSize = True
Me.label8.Location = New System.Drawing.Point(4, 119)
Me.label8.Name = "label8"
Me.label8.Size = New System.Drawing.Size(58, 14)
Me.label8.TabIndex = 32
Me.label8.Text = "Phone (W)"
'
'richTextBox1
'
Me.tableLayoutPanel1.SetColumnSpan(Me.richTextBox1, 3)
Me.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill
Me.richTextBox1.Location = New System.Drawing.Point(68, 143)
Me.richTextBox1.Name = "richTextBox1"
Me.richTextBox1.Size = New System.Drawing.Size(552, 140)
Me.richTextBox1.TabIndex = 8
Me.richTextBox1.Text = ""
'
'cancelBtn
'
Me.cancelBtn.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.cancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.cancelBtn.Location = New System.Drawing.Point(558, 306)
Me.cancelBtn.Name = "cancelBtn"
Me.cancelBtn.TabIndex = 1
Me.cancelBtn.Text = "Cancel"
'
'okBtn
'
Me.okBtn.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.okBtn.DialogResult = System.Windows.Forms.DialogResult.OK
Me.okBtn.Location = New System.Drawing.Point(476, 306)
Me.okBtn.Name = "okBtn"
Me.okBtn.TabIndex = 0
Me.okBtn.Text = "OK"
'
'BasicDataEntryForm
'
Me.ClientSize = New System.Drawing.Size(642, 338)
Me.Controls.Add(Me.okBtn)
Me.Controls.Add(Me.cancelBtn)
Me.Controls.Add(Me.tableLayoutPanel1)
Me.Name = "BasicDataEntryForm"
Me.Padding = New System.Windows.Forms.Padding(9)
Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual
Me.Text = "Basic Data Entry"
Me.tableLayoutPanel1.ResumeLayout(False)
Me.tableLayoutPanel1.PerformLayout()
Me.ResumeLayout(False)
End Sub
Friend WithEvents tableLayoutPanel1 As System.Windows.Forms.TableLayoutPanel
Friend WithEvents label1 As System.Windows.Forms.Label
Friend WithEvents label2 As System.Windows.Forms.Label
Friend WithEvents label3 As System.Windows.Forms.Label
Friend WithEvents label4 As System.Windows.Forms.Label
Friend WithEvents label5 As System.Windows.Forms.Label
Friend WithEvents label6 As System.Windows.Forms.Label
Friend WithEvents label7 As System.Windows.Forms.Label
Friend WithEvents label8 As System.Windows.Forms.Label
Friend WithEvents label9 As System.Windows.Forms.Label
Friend WithEvents cancelBtn As System.Windows.Forms.Button
Friend WithEvents okBtn As System.Windows.Forms.Button
Friend WithEvents textBox1 As System.Windows.Forms.TextBox
Friend WithEvents textBox2 As System.Windows.Forms.TextBox
Friend WithEvents textBox3 As System.Windows.Forms.TextBox
Friend WithEvents textBox4 As System.Windows.Forms.TextBox
Friend WithEvents textBox5 As System.Windows.Forms.TextBox
Friend WithEvents maskedTextBox1 As System.Windows.Forms.MaskedTextBox
Friend WithEvents maskedTextBox2 As System.Windows.Forms.MaskedTextBox
Friend WithEvents comboBox1 As System.Windows.Forms.ComboBox
Friend WithEvents richTextBox1 As System.Windows.Forms.RichTextBox
<STAThread()> _
Shared Sub Main()
Application.EnableVisualStyles()
Application.Run(New BasicDataEntryForm())
End Sub
End Class
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
// This form demonstrates how to build a form layout that adjusts well
// when the user resizes the form. It also demonstrates a layout that
// responds well to localization.
class BasicDataEntryForm : System.Windows.Forms.Form
{
public BasicDataEntryForm()
{
InitializeComponent();
}
private System.ComponentModel.IContainer components = null;
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
public override string ToString()
{
return "Basic Data Entry Form";
}
private void okBtn_Click(object sender, EventArgs e)
{
this.Close();
}
private void cancelBtn_Click(object sender, EventArgs e)
{
this.Close();
}
private void InitializeComponent()
{
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox4 = new System.Windows.Forms.TextBox();
this.textBox5 = new System.Windows.Forms.TextBox();
this.maskedTextBox1 = new System.Windows.Forms.MaskedTextBox();
this.maskedTextBox2 = new System.Windows.Forms.MaskedTextBox();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.cancelBtn = new System.Windows.Forms.Button();
this.okBtn = new System.Windows.Forms.Button();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel1.ColumnCount = 4;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.label2, 2, 0);
this.tableLayoutPanel1.Controls.Add(this.label3, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.label4, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.label5, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.label6, 2, 3);
this.tableLayoutPanel1.Controls.Add(this.label9, 2, 4);
this.tableLayoutPanel1.Controls.Add(this.textBox2, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.textBox3, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.textBox4, 1, 3);
this.tableLayoutPanel1.Controls.Add(this.textBox5, 3, 0);
this.tableLayoutPanel1.Controls.Add(this.maskedTextBox1, 1, 4);
this.tableLayoutPanel1.Controls.Add(this.maskedTextBox2, 3, 4);
this.tableLayoutPanel1.Controls.Add(this.comboBox1, 3, 3);
this.tableLayoutPanel1.Controls.Add(this.textBox1, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.label7, 0, 5);
this.tableLayoutPanel1.Controls.Add(this.label8, 0, 4);
this.tableLayoutPanel1.Controls.Add(this.richTextBox1, 1, 5);
this.tableLayoutPanel1.Location = new System.Drawing.Point(13, 13);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 6;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 80F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(623, 286);
this.tableLayoutPanel1.TabIndex = 0;
//
// label1
//
this.label1.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(3, 7);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(59, 14);
this.label1.TabIndex = 20;
this.label1.Text = "First Name";
//
// label2
//
this.label2.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(323, 7);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(59, 14);
this.label2.TabIndex = 21;
this.label2.Text = "Last Name";
//
// label3
//
this.label3.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(10, 35);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(52, 14);
this.label3.TabIndex = 22;
this.label3.Text = "Address1";
//
// label4
//
this.label4.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(7, 63);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(55, 14);
this.label4.TabIndex = 23;
this.label4.Text = "Address 2";
//
// label5
//
this.label5.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(38, 91);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(24, 14);
this.label5.TabIndex = 24;
this.label5.Text = "City";
//
// label6
//
this.label6.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(351, 91);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(31, 14);
this.label6.TabIndex = 25;
this.label6.Text = "State";
//
// label9
//
this.label9.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(326, 119);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(56, 14);
this.label9.TabIndex = 33;
this.label9.Text = "Phone (H)";
//
// textBox2
//
this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel1.SetColumnSpan(this.textBox2, 3);
this.textBox2.Location = new System.Drawing.Point(68, 32);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(552, 20);
this.textBox2.TabIndex = 2;
//
// textBox3
//
this.textBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel1.SetColumnSpan(this.textBox3, 3);
this.textBox3.Location = new System.Drawing.Point(68, 60);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(552, 20);
this.textBox3.TabIndex = 3;
//
// textBox4
//
this.textBox4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.textBox4.Location = new System.Drawing.Point(68, 88);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(249, 20);
this.textBox4.TabIndex = 4;
//
// textBox5
//
this.textBox5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.textBox5.Location = new System.Drawing.Point(388, 4);
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(232, 20);
this.textBox5.TabIndex = 1;
//
// maskedTextBox1
//
this.maskedTextBox1.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.maskedTextBox1.Location = new System.Drawing.Point(68, 116);
this.maskedTextBox1.Mask = "(999)000-0000";
this.maskedTextBox1.Name = "maskedTextBox1";
this.maskedTextBox1.TabIndex = 6;
//
// maskedTextBox2
//
this.maskedTextBox2.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.maskedTextBox2.Location = new System.Drawing.Point(388, 116);
this.maskedTextBox2.Mask = "(999)000-0000";
this.maskedTextBox2.Name = "maskedTextBox2";
this.maskedTextBox2.TabIndex = 7;
//
// comboBox1
//
this.comboBox1.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Items.AddRange(new object[] {
"AK - Alaska",
"WA - Washington"});
this.comboBox1.Location = new System.Drawing.Point(388, 87);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(100, 21);
this.comboBox1.TabIndex = 5;
//
// textBox1
//
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.textBox1.Location = new System.Drawing.Point(68, 4);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(249, 20);
this.textBox1.TabIndex = 0;
//
// label7
//
this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(28, 143);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(34, 14);
this.label7.TabIndex = 26;
this.label7.Text = "Notes";
//
// label8
//
this.label8.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(4, 119);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(58, 14);
this.label8.TabIndex = 32;
this.label8.Text = "Phone (W)";
//
// richTextBox1
//
this.tableLayoutPanel1.SetColumnSpan(this.richTextBox1, 3);
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBox1.Location = new System.Drawing.Point(68, 143);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(552, 140);
this.richTextBox1.TabIndex = 8;
this.richTextBox1.Text = "";
//
// cancelBtn
//
this.cancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelBtn.Location = new System.Drawing.Point(558, 306);
this.cancelBtn.Name = "cancelBtn";
this.cancelBtn.TabIndex = 1;
this.cancelBtn.Text = "Cancel";
this.cancelBtn.Click += new System.EventHandler(this.cancelBtn_Click);
//
// okBtn
//
this.okBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okBtn.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okBtn.Location = new System.Drawing.Point(476, 306);
this.okBtn.Name = "okBtn";
this.okBtn.TabIndex = 0;
this.okBtn.Text = "OK";
this.okBtn.Click += new System.EventHandler(this.okBtn_Click);
//
// BasicDataEntryForm
//
this.ClientSize = new System.Drawing.Size(642, 338);
this.Controls.Add(this.okBtn);
this.Controls.Add(this.cancelBtn);
this.Controls.Add(this.tableLayoutPanel1);
this.Name = "BasicDataEntryForm";
this.Padding = new System.Windows.Forms.Padding(9);
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "Basic Data Entry";
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.ResumeLayout(false);
}
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Button cancelBtn;
private System.Windows.Forms.Button okBtn;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.TextBox textBox5;
private System.Windows.Forms.MaskedTextBox maskedTextBox1;
private System.Windows.Forms.MaskedTextBox maskedTextBox2;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.RichTextBox richTextBox1;
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new BasicDataEntryForm());
}
}
#using <System.dll>
#using <System.Data.dll>
#using <System.Drawing.dll>
#using <System.Windows.Forms.dll>
using namespace System;
using namespace System::Collections::Generic;
using namespace System::ComponentModel;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Text;
using namespace System::Windows::Forms;
// This form demonstrates how to build a form layout that adjusts well
// when the user resizes the form. It also demonstrates a layout that
// responds well to localization.
ref class BasicDataEntryForm : public System::Windows::Forms::Form
{
public:
BasicDataEntryForm()
{
InitializeComponent();
components = nullptr;
}
private:
System::ComponentModel::IContainer^ components;
protected:
~BasicDataEntryForm()
{
if (components != nullptr)
{
delete components;
}
}
public:
virtual String^ ToString() override
{
return "Basic Data Entry Form";
}
private:
void okBtn_Click(Object^ sender, EventArgs^ e)
{
this->Close();
}
private:
void cancelBtn_Click(Object^ sender, EventArgs^ e)
{
this->Close();
}
private:
void InitializeComponent()
{
this->tableLayoutPanel1 = gcnew
System::Windows::Forms::TableLayoutPanel();
this->lblFirstName = gcnew System::Windows::Forms::Label();
this->lblLastName = gcnew System::Windows::Forms::Label();
this->lblAddress1 = gcnew System::Windows::Forms::Label();
this->lblAddress2 = gcnew System::Windows::Forms::Label();
this->lblCity = gcnew System::Windows::Forms::Label();
this->lblState = gcnew System::Windows::Forms::Label();
this->lblPhoneH = gcnew System::Windows::Forms::Label();
this->txtAddress1 = gcnew System::Windows::Forms::TextBox();
this->txtAddress2 = gcnew System::Windows::Forms::TextBox();
this->txtCity = gcnew System::Windows::Forms::TextBox();
this->txtLastName = gcnew System::Windows::Forms::TextBox();
this->maskedTxtPhoneW = gcnew System::Windows::Forms::MaskedTextBox();
this->maskedTxtPhoneH = gcnew System::Windows::Forms::MaskedTextBox();
this->cboState = gcnew System::Windows::Forms::ComboBox();
this->txtFirstName = gcnew System::Windows::Forms::TextBox();
this->lblNotes = gcnew System::Windows::Forms::Label();
this->lblPhoneW = gcnew System::Windows::Forms::Label();
this->richTxtNotes = gcnew System::Windows::Forms::RichTextBox();
this->cancelBtn = gcnew System::Windows::Forms::Button();
this->okBtn = gcnew System::Windows::Forms::Button();
this->tableLayoutPanel1->SuspendLayout();
this->SuspendLayout();
//
// tableLayoutPanel1
//
this->tableLayoutPanel1->Anchor =
System::Windows::Forms::AnchorStyles::Top |
System::Windows::Forms::AnchorStyles::Bottom|
System::Windows::Forms::AnchorStyles::Left |
System::Windows::Forms::AnchorStyles::Right;
this->tableLayoutPanel1->ColumnCount = 4;
this->tableLayoutPanel1->ColumnStyles->Add(gcnew
System::Windows::Forms::ColumnStyle());
this->tableLayoutPanel1->ColumnStyles->Add(gcnew
System::Windows::Forms::ColumnStyle(
System::Windows::Forms::SizeType::Percent, 50.0));
this->tableLayoutPanel1->ColumnStyles->Add(gcnew
System::Windows::Forms::ColumnStyle());
this->tableLayoutPanel1->ColumnStyles->Add(gcnew
System::Windows::Forms::ColumnStyle(
System::Windows::Forms::SizeType::Percent, 50.0));
this->tableLayoutPanel1->Controls->Add(this->lblFirstName, 0, 0);
this->tableLayoutPanel1->Controls->Add(this->lblLastName, 2, 0);
this->tableLayoutPanel1->Controls->Add(this->lblAddress1, 0, 1);
this->tableLayoutPanel1->Controls->Add(this->lblAddress2, 0, 2);
this->tableLayoutPanel1->Controls->Add(this->lblCity, 0, 3);
this->tableLayoutPanel1->Controls->Add(this->lblState, 2, 3);
this->tableLayoutPanel1->Controls->Add(this->lblPhoneH, 2, 4);
this->tableLayoutPanel1->Controls->Add(this->txtAddress1, 1, 1);
this->tableLayoutPanel1->Controls->Add(this->txtAddress2, 1, 2);
this->tableLayoutPanel1->Controls->Add(this->txtCity, 1, 3);
this->tableLayoutPanel1->Controls->Add(this->txtLastName, 3, 0);
this->tableLayoutPanel1->Controls->Add(this->maskedTxtPhoneW, 1, 4);
this->tableLayoutPanel1->Controls->Add(this->maskedTxtPhoneH, 3, 4);
this->tableLayoutPanel1->Controls->Add(this->cboState, 3, 3);
this->tableLayoutPanel1->Controls->Add(this->txtFirstName, 1, 0);
this->tableLayoutPanel1->Controls->Add(this->lblNotes, 0, 5);
this->tableLayoutPanel1->Controls->Add(this->lblPhoneW, 0, 4);
this->tableLayoutPanel1->Controls->Add(this->richTxtNotes, 1, 5);
this->tableLayoutPanel1->Location = System::Drawing::Point(13, 13);
this->tableLayoutPanel1->Name = "tableLayoutPanel1";
this->tableLayoutPanel1->RowCount = 6;
this->tableLayoutPanel1->RowStyles->Add(gcnew
System::Windows::Forms::RowStyle(
System::Windows::Forms::SizeType::Absolute, 28.0));
this->tableLayoutPanel1->RowStyles->Add(gcnew
System::Windows::Forms::RowStyle(
System::Windows::Forms::SizeType::Absolute, 28.0));
this->tableLayoutPanel1->RowStyles->Add(gcnew
System::Windows::Forms::RowStyle(
System::Windows::Forms::SizeType::Absolute, 28.0));
this->tableLayoutPanel1->RowStyles->Add(gcnew
System::Windows::Forms::RowStyle(
System::Windows::Forms::SizeType::Absolute, 28.0));
this->tableLayoutPanel1->RowStyles->Add(gcnew
System::Windows::Forms::RowStyle(
System::Windows::Forms::SizeType::Absolute, 28.0));
this->tableLayoutPanel1->RowStyles->Add(gcnew
System::Windows::Forms::RowStyle(
System::Windows::Forms::SizeType::Percent, 80.0));
this->tableLayoutPanel1->RowStyles->Add(gcnew
System::Windows::Forms::RowStyle(
System::Windows::Forms::SizeType::Absolute, 20.0));
this->tableLayoutPanel1->Size = System::Drawing::Size(623, 286);
this->tableLayoutPanel1->TabIndex = 0;
//
// lblFirstName
//
this->lblFirstName->Anchor =
System::Windows::Forms::AnchorStyles::Right;
this->lblFirstName->AutoSize = true;
this->lblFirstName->Location = System::Drawing::Point(3, 7);
this->lblFirstName->Name = "lblFirstName";
this->lblFirstName->Size = System::Drawing::Size(59, 14);
this->lblFirstName->TabIndex = 20;
this->lblFirstName->Text = "First Name";
//
// lblLastName
//
this->lblLastName->Anchor =
System::Windows::Forms::AnchorStyles::Right;
this->lblLastName->AutoSize = true;
this->lblLastName->Location = System::Drawing::Point(323, 7);
this->lblLastName->Name = "lblLastName";
this->lblLastName->Size = System::Drawing::Size(59, 14);
this->lblLastName->TabIndex = 21;
this->lblLastName->Text = "Last Name";
//
// lblAddress1
//
this->lblAddress1->Anchor =
System::Windows::Forms::AnchorStyles::Right;
this->lblAddress1->AutoSize = true;
this->lblAddress1->Location = System::Drawing::Point(10, 35);
this->lblAddress1->Name = "lblAddress1";
this->lblAddress1->Size = System::Drawing::Size(52, 14);
this->lblAddress1->TabIndex = 22;
this->lblAddress1->Text = "Address1";
//
// lblAddress2
//
this->lblAddress2->Anchor =
System::Windows::Forms::AnchorStyles::Right;
this->lblAddress2->AutoSize = true;
this->lblAddress2->Location = System::Drawing::Point(7, 63);
this->lblAddress2->Name = "lblAddress2";
this->lblAddress2->Size = System::Drawing::Size(55, 14);
this->lblAddress2->TabIndex = 23;
this->lblAddress2->Text = "Address 2";
//
// lblCity
//
this->lblCity->Anchor =
System::Windows::Forms::AnchorStyles::Right;
this->lblCity->AutoSize = true;
this->lblCity->Location = System::Drawing::Point(38, 91);
this->lblCity->Name = "lblCity";
this->lblCity->Size = System::Drawing::Size(24, 14);
this->lblCity->TabIndex = 24;
this->lblCity->Text = "City";
//
// lblState
//
this->lblState->Anchor =
System::Windows::Forms::AnchorStyles::Right;
this->lblState->AutoSize = true;
this->lblState->Location = System::Drawing::Point(351, 91);
this->lblState->Name = "lblState";
this->lblState->Size = System::Drawing::Size(31, 14);
this->lblState->TabIndex = 25;
this->lblState->Text = "State";
//
// lblPhoneH
//
this->lblPhoneH->Anchor =
System::Windows::Forms::AnchorStyles::Right;
this->lblPhoneH->AutoSize = true;
this->lblPhoneH->Location = System::Drawing::Point(326, 119);
this->lblPhoneH->Name = "lblPhoneH";
this->lblPhoneH->Size = System::Drawing::Size(56, 14);
this->lblPhoneH->TabIndex = 33;
this->lblPhoneH->Text = "Phone (H)";
//
// txtAddress1
//
this->txtAddress1->Anchor =
System::Windows::Forms::AnchorStyles::Left |
System::Windows::Forms::AnchorStyles::Right;
this->tableLayoutPanel1->SetColumnSpan(this->txtAddress1, 3);
this->txtAddress1->Location = System::Drawing::Point(68, 32);
this->txtAddress1->Name = "txtAddress1";
this->txtAddress1->Size = System::Drawing::Size(552, 20);
this->txtAddress1->TabIndex = 2;
//
// txtAddress2
//
this->txtAddress2->Anchor =
System::Windows::Forms::AnchorStyles::Left |
System::Windows::Forms::AnchorStyles::Right;
this->tableLayoutPanel1->SetColumnSpan(this->txtAddress2, 3);
this->txtAddress2->Location = System::Drawing::Point(68, 60);
this->txtAddress2->Name = "txtAddress2";
this->txtAddress2->Size = System::Drawing::Size(552, 20);
this->txtAddress2->TabIndex = 3;
//
// txtCity
//
this->txtCity->Anchor =
System::Windows::Forms::AnchorStyles::Left |
System::Windows::Forms::AnchorStyles::Right;
this->txtCity->Location = System::Drawing::Point(68, 88);
this->txtCity->Name = "txtCity";
this->txtCity->Size = System::Drawing::Size(249, 20);
this->txtCity->TabIndex = 4;
//
// txtLastName
//
this->txtLastName->Anchor =
System::Windows::Forms::AnchorStyles::Left |
System::Windows::Forms::AnchorStyles::Right;
this->txtLastName->Location = System::Drawing::Point(388, 4);
this->txtLastName->Name = "txtLastName";
this->txtLastName->Size = System::Drawing::Size(232, 20);
this->txtLastName->TabIndex = 1;
//
// maskedTxtPhoneW
//
this->maskedTxtPhoneW->Anchor =
System::Windows::Forms::AnchorStyles::Left;
this->maskedTxtPhoneW->Location = System::Drawing::Point(68, 116);
this->maskedTxtPhoneW->Mask = "(999)000-0000";
this->maskedTxtPhoneW->Name = "maskedTxtPhoneW";
this->maskedTxtPhoneW->TabIndex = 6;
//
// maskedTxtPhoneH
//
this->maskedTxtPhoneH->Anchor =
System::Windows::Forms::AnchorStyles::Left;
this->maskedTxtPhoneH->Location = System::Drawing::Point(388, 116);
this->maskedTxtPhoneH->Mask = "(999)000-0000";
this->maskedTxtPhoneH->Name = "maskedTxtPhoneH";
this->maskedTxtPhoneH->TabIndex = 7;
//
// cboState
//
this->cboState->Anchor = System::Windows::Forms::AnchorStyles::Left;
this->cboState->FormattingEnabled = true;
this->cboState->Items->AddRange(gcnew array<Object^> {
"AK - Alaska",
"WA - Washington"});
this->cboState->Location = System::Drawing::Point(388, 87);
this->cboState->Name = "cboState";
this->cboState->Size = System::Drawing::Size(100, 21);
this->cboState->TabIndex = 5;
//
// txtFirstName
//
this->txtFirstName->Anchor =
System::Windows::Forms::AnchorStyles::Left |
System::Windows::Forms::AnchorStyles::Right;
this->txtFirstName->Location = System::Drawing::Point(68, 4);
this->txtFirstName->Name = "txtFirstName";
this->txtFirstName->Size = System::Drawing::Size(249, 20);
this->txtFirstName->TabIndex = 0;
//
// lblNotes
//
this->lblNotes->Anchor =
System::Windows::Forms::AnchorStyles::Top |
System::Windows::Forms::AnchorStyles::Right;
this->lblNotes->AutoSize = true;
this->lblNotes->Location = System::Drawing::Point(28, 143);
this->lblNotes->Name = "lblNotes";
this->lblNotes->Size = System::Drawing::Size(34, 14);
this->lblNotes->TabIndex = 26;
this->lblNotes->Text = "Notes";
//
// lblPhoneW
//
this->lblPhoneW->Anchor =
System::Windows::Forms::AnchorStyles::Right;
this->lblPhoneW->AutoSize = true;
this->lblPhoneW->Location = System::Drawing::Point(4, 119);
this->lblPhoneW->Name = "lblPhoneW";
this->lblPhoneW->Size = System::Drawing::Size(58, 14);
this->lblPhoneW->TabIndex = 32;
this->lblPhoneW->Text = "Phone (W)";
//
// richTxtNotes
//
this->tableLayoutPanel1->SetColumnSpan(this->richTxtNotes, 3);
this->richTxtNotes->Dock = System::Windows::Forms::DockStyle::Fill;
this->richTxtNotes->Location = System::Drawing::Point(68, 143);
this->richTxtNotes->Name = "richTxtNotes";
this->richTxtNotes->Size = System::Drawing::Size(552, 140);
this->richTxtNotes->TabIndex = 8;
this->richTxtNotes->Text = "";
//
// cancelBtn
//
this->cancelBtn->Anchor =
System::Windows::Forms::AnchorStyles::Bottom |
System::Windows::Forms::AnchorStyles::Right;
this->cancelBtn->DialogResult =
System::Windows::Forms::DialogResult::Cancel;
this->cancelBtn->Location = System::Drawing::Point(558, 306);
this->cancelBtn->Name = "cancelBtn";
this->cancelBtn->TabIndex = 1;
this->cancelBtn->Text = "Cancel";
this->cancelBtn->Click += gcnew System::EventHandler(
this, &BasicDataEntryForm::cancelBtn_Click);
//
// okBtn
//
this->okBtn->Anchor =
System::Windows::Forms::AnchorStyles::Bottom |
System::Windows::Forms::AnchorStyles::Right;
this->okBtn->DialogResult =
System::Windows::Forms::DialogResult::OK;
this->okBtn->Location = System::Drawing::Point(476, 306);
this->okBtn->Name = "okBtn";
this->okBtn->TabIndex = 0;
this->okBtn->Text = "OK";
this->okBtn->Click += gcnew System::EventHandler(
this, &BasicDataEntryForm::okBtn_Click);
//
// BasicDataEntryForm
//
this->AutoScaleBaseSize = System::Drawing::Size(5, 13);
this->ClientSize = System::Drawing::Size(642, 338);
this->Controls->Add(this->okBtn);
this->Controls->Add(this->cancelBtn);
this->Controls->Add(this->tableLayoutPanel1);
this->Name = "BasicDataEntryForm";
this->Padding = System::Windows::Forms::Padding(9);
this->StartPosition =
System::Windows::Forms::FormStartPosition::Manual;
this->Text = "Basic Data Entry";
this->tableLayoutPanel1->ResumeLayout(false);
this->tableLayoutPanel1->PerformLayout();
this->ResumeLayout(false);
}
private:
System::Windows::Forms::TableLayoutPanel^ tableLayoutPanel1;
System::Windows::Forms::Label^ lblFirstName;
System::Windows::Forms::Label^ lblLastName;
System::Windows::Forms::Label^ lblAddress1;
System::Windows::Forms::Label^ lblAddress2;
System::Windows::Forms::Label^ lblCity;
System::Windows::Forms::Label^ lblState;
System::Windows::Forms::Label^ lblNotes;
System::Windows::Forms::Label^ lblPhoneW;
System::Windows::Forms::Label^ lblPhoneH;
System::Windows::Forms::Button^ cancelBtn;
System::Windows::Forms::Button^ okBtn;
System::Windows::Forms::TextBox^ txtFirstName;
System::Windows::Forms::TextBox^ txtAddress1;
System::Windows::Forms::TextBox^ txtAddress2;
System::Windows::Forms::TextBox^ txtCity;
System::Windows::Forms::TextBox^ txtLastName;
System::Windows::Forms::MaskedTextBox^ maskedTxtPhoneW;
System::Windows::Forms::MaskedTextBox^ maskedTxtPhoneH;
System::Windows::Forms::ComboBox^ cboState;
System::Windows::Forms::RichTextBox^ richTxtNotes;
};
[STAThread]
int main()
{
Application::EnableVisualStyles();
Application::Run(gcnew BasicDataEntryForm());
}
Kompilieren des Codes
Für dieses Beispiel sind erforderlich:
- Verweise auf die Assemblys System, System.Data, System.Drawing und System.Windows.Forms.
Informationen zum Erstellen dieses Beispiels über die Befehlszeile für Visual Basic oder Visual C# finden Sie unter Erstellen von der Befehlszeile aus (Visual Basic) und Erstellen über die Befehlszeile mit csc.exe. Sie können dieses Beispiel auch in Visual Studio erstellen, indem Sie den Code in ein neues Projekt einfügen. Weitere Informationen finden Sie unter Gewusst wie: Kompilieren und Ausführen eines vollständigen Windows Forms-Codebeispiels mit Visual Studio und Gewusst wie: Kompilieren und Ausführen eines vollständigen Windows Forms-Codebeispiels mit Visual Studio und Gewusst wie: Kompilieren und Ausführen eines vollständigen Windows Forms-Codebeispiels mit Visual Studio und Gewusst wie: Kompilieren und Ausführen eines vollständigen Windows Forms-Codebeispiels mit Visual Studio und Gewusst wie: Kompilieren und Ausführen eines vollständigen Windows Forms-Codebeispiels mit Visual Studio.
Siehe auch
Aufgaben
Gewusst wie: Entwerfen eines Windows Forms-Layouts, das zur Lokalisierung gut geeignet ist