125 lines
4.7 KiB
PowerShell
125 lines
4.7 KiB
PowerShell
Add-Type -AssemblyName System.Windows.Forms
|
|
|
|
$form = New-Object System.Windows.Forms.Form -Property @{
|
|
Text = 'Data Entry Form'
|
|
Size = New-Object System.Drawing.Size(690,380)
|
|
StartPosition = 'CenterScreen'
|
|
}
|
|
|
|
$groupbox = New-Object System.Windows.Forms.GroupBox -Property @{
|
|
Location = New-Object System.Drawing.Point(8,0)
|
|
Size = New-Object System.Drawing.Size(350,300)
|
|
Text = "Group Box"
|
|
}
|
|
|
|
$textBoxVorname = New-Object System.Windows.Forms.TextBox -Property @{
|
|
Location = New-Object System.Drawing.Point(($groupbox.Width-120-8), 40)
|
|
Size = New-Object System.Drawing.Size(120,20)
|
|
}
|
|
|
|
$textBoxName = New-Object System.Windows.Forms.TextBox -Property @{
|
|
Location = New-Object System.Drawing.Point(($groupbox.Width-120-8), 68)
|
|
Size = New-Object System.Drawing.Size(120,20)
|
|
}
|
|
|
|
$labelWidth = 50
|
|
|
|
$labelVorname = New-Object System.Windows.Forms.Label -Property @{
|
|
Text = "Vorname"
|
|
Location = New-Object System.Drawing.Point(($groupbox.Width-120-$labelWidth-16), $textBoxVorname.Top)
|
|
Size = New-Object System.Drawing.Size($labelWidth,20)
|
|
TextAlign = 64
|
|
}
|
|
|
|
$labelName = New-Object System.Windows.Forms.Label -Property @{
|
|
Text = "Name"
|
|
Location = New-Object System.Drawing.Point(($groupbox.Width-120-$labelWidth-16), $textBoxName.Top)
|
|
Size = New-Object System.Drawing.Size($labelWidth,20)
|
|
TextAlign = 64
|
|
}
|
|
|
|
$attributeDistance = 24
|
|
$marginBottom = 8
|
|
|
|
$checkBoxAzubi = New-Object System.Windows.Forms.CheckBox -Property @{
|
|
Text = "Azubi"
|
|
Location = New-Object System.Drawing.Point(8, ($groupbox.Height - $marginBottom - $attributeDistance*4))
|
|
Size = New-Object System.Drawing.Size(80,20)
|
|
TextAlign = 16
|
|
}
|
|
|
|
$radioSingle = New-Object System.Windows.Forms.RadioButton -Property @{
|
|
Text = "Single"
|
|
Location = New-Object System.Drawing.Point(8, ($groupbox.Height - $marginBottom - $attributeDistance*3))
|
|
Size = New-Object System.Drawing.Size(80,20)
|
|
TextAlign = 16
|
|
}
|
|
|
|
$radioVergeben = New-Object System.Windows.Forms.RadioButton -Property @{
|
|
Text = "Vergeben"
|
|
Location = New-Object System.Drawing.Point(8, ($groupbox.Height - $marginBottom - $attributeDistance*2))
|
|
Size = New-Object System.Drawing.Size(80,20)
|
|
TextAlign = 16
|
|
}
|
|
|
|
$comboBox = New-Object System.Windows.Forms.ComboBox -Property @{
|
|
Text = "comboBox"
|
|
Location = New-Object System.Drawing.Point(8, ($groupbox.Height - $marginBottom - $attributeDistance*1))
|
|
Size = New-Object System.Drawing.Size(120,20)
|
|
}
|
|
|
|
$picture = New-Object System.Windows.Forms.PictureBox -Property @{
|
|
Location = New-Object System.Drawing.Point(8, 16)
|
|
Size = New-Object System.Drawing.Size(($groupbox.Width-200-24), ($groupbox.Height - $marginBottom - $attributeDistance*4 - 24))
|
|
SizeMode = [System.Windows.Forms.PictureBoxSizeMode]::AutoSize
|
|
BackgroundImage = [System.Drawing.Image]::FromFile("C:\Users\krume\OneDrive - Klara-Oppenheimer-Schule\neuland logo.png")
|
|
}
|
|
|
|
$groupbox.Controls.AddRange($($textBoxVorname, $textBoxName, $labelVorname, $labelName, $checkBoxAzubi, $radioSingle, $radioVergeben, $comboBox, $picture))
|
|
|
|
$form.Controls.Add($groupbox)
|
|
|
|
$listBox = New-Object System.Windows.Forms.ListBox -Property @{
|
|
Location = New-Object System.Drawing.Point(($groupbox.Width + $groupbox.Left + 8), 8)
|
|
Size = New-Object System.Drawing.Size(300, 300)
|
|
}
|
|
|
|
$button = New-Object System.Windows.Forms.Button -Property @{
|
|
Text = "Knopf"
|
|
Location = New-Object System.Drawing.Point(($listBox.Left + $listBox.Width - 100), 302)
|
|
Size = New-Object System.Drawing.Size(100, 30)
|
|
|
|
}
|
|
|
|
$form.Controls.Add($listBox)
|
|
$form.Controls.Add($button)
|
|
|
|
# $okButton = New-Object System.Windows.Forms.Button
|
|
# $okButton.Location = New-Object System.Drawing.Point(75,120)
|
|
# $okButton.Size = New-Object System.Drawing.Size(75,23)
|
|
# $okButton.Text = 'OK'
|
|
# $okButton.DialogResult = [System.Windows.Forms.DialogResult]::OK
|
|
# $form.AcceptButton = $okButton
|
|
# $form.Controls.Add($okButton)
|
|
|
|
# $cancelButton = New-Object System.Windows.Forms.Button
|
|
# $cancelButton.Location = New-Object System.Drawing.Point(150,120)
|
|
# $cancelButton.Size = New-Object System.Drawing.Size(75,23)
|
|
# $cancelButton.Text = 'Cancel'
|
|
# $cancelButton.DialogResult = [System.Windows.Forms.DialogResult]::Cancel
|
|
# $form.CancelButton = $cancelButton
|
|
# $form.Controls.Add($cancelButton)
|
|
|
|
# $label = New-Object System.Windows.Forms.Label
|
|
# $label.Location = New-Object System.Drawing.Point(10,20)
|
|
# $label.Size = New-Object System.Drawing.Size(280,20)
|
|
# $label.Text = 'Please enter the information in the space below:'
|
|
# $form.Controls.Add($label)
|
|
|
|
# $textBox = New-Object System.Windows.Forms.TextBox
|
|
# $textBox.Location = New-Object System.Drawing.Point(10,40)
|
|
# $textBox.Size = New-Object System.Drawing.Size(260,20)
|
|
# $form.Controls.Add($textBox)
|
|
|
|
$form.Topmost = $true
|
|
$form.ShowDialog() |