Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2314

Farbe ändern in der Reiter Überschrift sowie Variable übergeben für den zweiten reiter

$
0
0

Hallo und guten Morgen,

 

  1. Ich versuche wenn das alle Felder ausgefühlt sind das die Überschrift in Grün hinterlegt wird, In dem Beispiel ist nur ein Feld vorhanden.
  2. Würde gern, wenn eine Eingabe erfolgt ist und ich dann auf dem zweiten Tab klicke (bzw. Öffne) das dann die Eingabe übernommen wird und im Feld ersichtlich ist, so dass man die Eingabe ggf. Anpassen kann.

 

Ist das beides möglich? Habe schon einiges versucht nur irgendwie bekomm ich das nicht hin :-(.

 

Hier ein Beispiel, vielleicht kann mir ja dabei jemand helfe, lieb Frag :-O.

[reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null
[reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null



$form1 = New-Object System.Windows.Forms.Form
$statusBar1 = New-Object System.Windows.Forms.StatusBar
$tabControl1 = New-Object System.Windows.Forms.TabControl
$tabPage1 = New-Object System.Windows.Forms.TabPage
$comboBox1 = New-Object System.Windows.Forms.ComboBox
$tabPage2 = New-Object System.Windows.Forms.TabPage
$button1 = New-Object System.Windows.Forms.Button

$form1.Text = "Test"
$form1.Name = "form1"
$form1.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Width = 284
$System_Drawing_Size.Height = 262
$form1.ClientSize = $System_Drawing_Size

$tabControl1.TabIndex = 0
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Width = 228
$System_Drawing_Size.Height = 162
$tabControl1.Size = $System_Drawing_Size
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 23
$System_Drawing_Point.Y = 35
$tabControl1.Location = $System_Drawing_Point
$tabControl1.DataBindings.DefaultDataSourceUpdateMode = 0
$tabControl1.Name = "tabControl1"
$tabControl1.SelectedIndex = 0
$form1.Controls.Add($tabControl1)

$tabPage1.TabIndex = 0
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Width = 220
$System_Drawing_Size.Height = 136
$tabPage1.Size = $System_Drawing_Size
$tabPage1.Text = "Test TAB 1"
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 4
$System_Drawing_Point.Y = 22
$tabPage1.Location = $System_Drawing_Point
$System_Windows_Forms_Padding = New-Object System.Windows.Forms.Padding
$System_Windows_Forms_Padding.All = 3
$System_Windows_Forms_Padding.Bottom = 3
$System_Windows_Forms_Padding.Left = 3
$System_Windows_Forms_Padding.Right = 3
$System_Windows_Forms_Padding.Top = 3
$tabPage1.Padding = $System_Windows_Forms_Padding
$tabPage1.Name = "tabPage1"
$tabPage1.DataBindings.DefaultDataSourceUpdateMode = 0
$tabControl1.Controls.Add($tabPage1)


		$Input1Label = New-Object System.Windows.Forms.Label
		$Input1Label.Location = New-Object System.Drawing.Size(10,40)
		$Input1Label.Size = New-Object System.Drawing.Size(80,20)
		$Input1Label.Text = "Eingabe 1"
		$tabPage1.Controls.Add($Input1Label)
		$Input1TextBox = New-Object System.Windows.Forms.TextBox
		$Input1TextBox.Location = New-Object System.Drawing.Size(10,60)
		$Input1TextBox.Size = New-Object System.Drawing.Size(80,20)
		$Input1TextBox.Text = ""
		$tabPage1.Controls.Add($Input1TextBox)

Function Variable {
	$global:Input1=$OdnerAnlegenButton.Text
}

Function Reset {
	$Input1 = ""
	$Input1TextBox.Text = ""
}

	$OKButton = New-Object System.Windows.Forms.Button
	$OKButton.Location = New-Object System.Drawing.Size(10,90)
	$OKButton.Size = New-Object System.Drawing.Size(50,23)
	$OKButton.Text = "OK"
	$tabPage1.Controls.Add($OKButton)
	$OKButton.Add_Click({Variable})

	$ResetButton = New-Object System.Windows.Forms.Button
	$ResetButton.Location = New-Object System.Drawing.Size(65,90)
	$ResetButton.Size = New-Object System.Drawing.Size(50,23)
	$ResetButton.Text = "Reset"
	$tabPage1.Controls.Add($ResetButton)
	$ResetButton.Add_Click({Reset})

	$CloseButton = New-Object System.Windows.Forms.Button
	$CloseButton.Location = New-Object System.Drawing.Size(120,90)
	$CloseButton.Size = New-Object System.Drawing.Size(50,23)
	$CloseButton.Text = "Close"
	$tabPage1.Controls.Add($CloseButton)
	$CloseButton.Add_Click({$Form1.Close();{return}})



$tabPage2.TabIndex = 1
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Width = 220
$System_Drawing_Size.Height = 136
$tabPage2.Size = $System_Drawing_Size
$tabPage2.Text = "Test TAB 2"
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 4
$System_Drawing_Point.Y = 22
$tabPage2.Location = $System_Drawing_Point
$System_Windows_Forms_Padding = New-Object System.Windows.Forms.Padding
$System_Windows_Forms_Padding.All = 3
$System_Windows_Forms_Padding.Bottom = 3
$System_Windows_Forms_Padding.Left = 3
$System_Windows_Forms_Padding.Right = 3
$System_Windows_Forms_Padding.Top = 3
$tabPage2.Padding = $System_Windows_Forms_Padding
$tabPage2.Name = "tabPage2"
$tabPage2.DataBindings.DefaultDataSourceUpdateMode = 0
$tabControl1.Controls.Add($tabPage2)


		$Input2Label = New-Object System.Windows.Forms.Label
		$Input2Label.Location = New-Object System.Drawing.Size(10,40)
		$Input2Label.Size = New-Object System.Drawing.Size(200,20)
		$Input2Label.Text = "Eingabe 2 übernommen aus TAB 1"
		$tabPage2.Controls.Add($Input2Label)
		$Input2TextBox = New-Object System.Windows.Forms.TextBox
		$Input2TextBox.Location = New-Object System.Drawing.Size(10,60)
		$Input2TextBox.Size = New-Object System.Drawing.Size(200,20)
		$Input2TextBox.Text = ""
		$tabPage2.Controls.Add($Input2TextBox)

$form1.ShowDialog()| Out-Null

Gruss

Markus


Viewing all articles
Browse latest Browse all 2314


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>