Question Pave numerique en powershell

Plus d'informations
il y a 10 mois 2 jours #29630 par krouk
Pave numerique en powershell a été créé par krouk
Bonjour,

Je voudrais créer une clavier numérique en powershell.
Mon problème est que quand je clique sur un chiffre celui vire ce qu il y avait avant dans la textbox, mais moi je voudrais le garder.
Merci d'avance pour le coups de main

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

$form1 = New-Object System.Windows.Forms.Form
$button10 = New-Object System.Windows.Forms.Button
$button9 = New-Object System.Windows.Forms.Button
$button8 = New-Object System.Windows.Forms.Button
$button7 = New-Object System.Windows.Forms.Button
$button6 = New-Object System.Windows.Forms.Button
$button5 = New-Object System.Windows.Forms.Button
$button4 = New-Object System.Windows.Forms.Button
$button3 = New-Object System.Windows.Forms.Button
$button2 = New-Object System.Windows.Forms.Button
$button1 = New-Object System.Windows.Forms.Button
$textBox1 = New-Object System.Windows.Forms.TextBox
$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState

$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 359
$System_Drawing_Size.Width = 313
$form1.ClientSize = $System_Drawing_Size
$form1.DataBindings.DefaultDataSourceUpdateMode = 0
$form1.Name = \"form1\"
$form1.StartPosition = 1
$form1.Text = \"\"
$form1.KeyPreview = $True

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 39
$System_Drawing_Point.Y = 263
$button10.Location = $System_Drawing_Point
$button10.Name = \"button10\"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 55
$System_Drawing_Size.Width = 244
$button10.Size = $System_Drawing_Size
$button10.TabIndex = 9
$button10.Text = \"0\"
$button10.UseVisualStyleBackColor = $True
$button10.add_click({$textBox1.Text = \"0\"})
$form1.Controls.Add($button10)

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 204
$System_Drawing_Point.Y = 183
$button9.Location = $System_Drawing_Point
$button9.Name = \"button9\"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 67
$System_Drawing_Size.Width = 80
$button9.Size = $System_Drawing_Size
$button9.TabIndex = 8
$button9.Text = \"9\"
$button9.UseVisualStyleBackColor = $True
$button9.add_click({$textBox1.Text = \"9\"})
$form1.Controls.Add($button9)

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 122
$System_Drawing_Point.Y = 183
$button8.Location = $System_Drawing_Point
$button8.Name = \"button8\"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 68
$System_Drawing_Size.Width = 76
$button8.Size = $System_Drawing_Size
$button8.TabIndex = 7
$button8.Text = \"8\"
$button8.UseVisualStyleBackColor = $True
$button8.add_click({$textBox1.Text = \"8\"})
$form1.Controls.Add($button8)

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 36
$System_Drawing_Point.Y = 183
$button7.Location = $System_Drawing_Point
$button7.Name = \"button7\"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 68
$System_Drawing_Size.Width = 79
$button7.Size = $System_Drawing_Size
$button7.TabIndex = 6
$button7.Text = \"7\"
$button7.UseVisualStyleBackColor = $True
$button7.add_click({$textBox1.Text = \"7\"})

$form1.Controls.Add($button7)


$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 207
$System_Drawing_Point.Y = 109
$button6.Location = $System_Drawing_Point
$button6.Name = \"button6\"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 67
$System_Drawing_Size.Width = 77
$button6.Size = $System_Drawing_Size
$button6.TabIndex = 5
$button6.Text = \"6\"
$button6.UseVisualStyleBackColor = $True
$button6.add_click({$textBox1.Text = \"6\"})
$form1.Controls.Add($button6)

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 121
$System_Drawing_Point.Y = 109
$button5.Location = $System_Drawing_Point
$button5.Name = \"button5\"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 68
$System_Drawing_Size.Width = 78
$button5.Size = $System_Drawing_Size
$button5.TabIndex = 4
$button5.Text = \"5\"
$button5.UseVisualStyleBackColor = $True
$button5.add_click({$textBox1.Text = \"5\"})
$form1.Controls.Add($button5)

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 36
$System_Drawing_Point.Y = 109
$button4.Location = $System_Drawing_Point
$button4.Name = \"button4\"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 68
$System_Drawing_Size.Width = 79
$button4.Size = $System_Drawing_Size
$button4.TabIndex = 3
$button4.Text = \"4\"
$button4.UseVisualStyleBackColor = $True
$button4.add_click({$textBox1.Text = \"4\"})
$form1.Controls.Add($button4)

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 206
$System_Drawing_Point.Y = 35
$button3.Location = $System_Drawing_Point
$button3.Name = \"button3\"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 68
$System_Drawing_Size.Width = 79
$button3.Size = $System_Drawing_Size
$button3.TabIndex = 2
$button3.Text = \"3\"
$button3.UseVisualStyleBackColor = $True
$button3.add_click({$textBox1.Text = \"3\"})
$form1.Controls.Add($button3)

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 121
$System_Drawing_Point.Y = 36
$button2.Location = $System_Drawing_Point
$button2.Name = \"button2\"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 67
$System_Drawing_Size.Width = 79
$button2.Size = $System_Drawing_Size
$button2.TabIndex = 1
$button2.Text = \"2\"
$button2.UseVisualStyleBackColor = $True
$button2.add_click({$textBox1.Text = \"2\"})
$form1.Controls.Add($button2)

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 36
$System_Drawing_Point.Y = 35
$button1.Location = $System_Drawing_Point
$button1.Name = \"button1\"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 68
$System_Drawing_Size.Width = 79
$button1.Size = $System_Drawing_Size
$button1.TabIndex = 0
$button1.Text = \"1\"
$button1.UseVisualStyleBackColor = $True
$button1.add_click({$textBox1.Text = \"1\"})
$form1.Controls.Add($button1)

$textBox1.DataBindings.DefaultDataSourceUpdateMode = 0
$textBox1.Font = New-Object System.Drawing.Font(\"Microsoft Sans Serif\",20.25,0,3,0)
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 35
$System_Drawing_Point.Y = 320
$textBox1.Location = $System_Drawing_Point
$textBox1.Name = \"textBox1\"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 50
$System_Drawing_Size.Width = 227
$textBox1.Size = $System_Drawing_Size
$textBox1.TabIndex = 1

$form1.Controls.Add($textBox1)

$InitialFormWindowState = $form1.WindowState
$form1.add_Load($OnLoadForm_StateCorrection)
$form1.ShowDialog()| Out-Null<br><br>Message édité par: krouk, à: 23/01/20 07:40
Pièces jointes :

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 10 mois 1 jour #29631 par Troxsa
Réponse de Troxsa sur le sujet Re:Pave numerique en powershell
[code:1]
[reflection.assembly]::loadwithpartialname(\&quot;System.Drawing\&quot;«») | Out-Null
[reflection.assembly]::loadwithpartialname(\&quot;System.Windows.Forms\&quot;«») | Out-Null

$form1 = New-Object System.Windows.Forms.Form
$button10 = New-Object System.Windows.Forms.Button
$button9 = New-Object System.Windows.Forms.Button
$button8 = New-Object System.Windows.Forms.Button
$button7 = New-Object System.Windows.Forms.Button
$button6 = New-Object System.Windows.Forms.Button
$button5 = New-Object System.Windows.Forms.Button
$button4 = New-Object System.Windows.Forms.Button
$button3 = New-Object System.Windows.Forms.Button
$button2 = New-Object System.Windows.Forms.Button
$button1 = New-Object System.Windows.Forms.Button
$textBox1 = New-Object System.Windows.Forms.TextBox
$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState

$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 359
$System_Drawing_Size.Width = 313
$form1.ClientSize = $System_Drawing_Size
$form1.DataBindings.DefaultDataSourceUpdateMode = 0
$form1.Name = \&quot;form1\&quot;
$form1.StartPosition = 1
$form1.Text = \&quot;\&quot;
$form1.KeyPreview = $True

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 39
$System_Drawing_Point.Y = 263
$button10.Location = $System_Drawing_Point
$button10.Name = \&quot;button10\&quot;
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 55
$System_Drawing_Size.Width = 244
$button10.Size = $System_Drawing_Size
$button10.TabIndex = 9
$button10.Text = \&quot;0\&quot;
$button10.UseVisualStyleBackColor = $True
$button10.add_click({$textBox1.Text += \&quot;0\&quot;})
$form1.Controls.Add($button10)

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 204
$System_Drawing_Point.Y = 183
$button9.Location = $System_Drawing_Point
$button9.Name = \&quot;button9\&quot;
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 67
$System_Drawing_Size.Width = 80
$button9.Size = $System_Drawing_Size
$button9.TabIndex = 8
$button9.Text = \&quot;9\&quot;
$button9.UseVisualStyleBackColor = $True
$button9.add_click({$textBox1.Text += \&quot;9\&quot;})
$form1.Controls.Add($button9)

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 122
$System_Drawing_Point.Y = 183
$button8.Location = $System_Drawing_Point
$button8.Name = \&quot;button8\&quot;
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 68
$System_Drawing_Size.Width = 76
$button8.Size = $System_Drawing_Size
$button8.TabIndex = 7
$button8.Text = \&quot;8\&quot;
$button8.UseVisualStyleBackColor = $True
$button8.add_click({$textBox1.Text += \&quot;8\&quot;})
$form1.Controls.Add($button8)

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 36
$System_Drawing_Point.Y = 183
$button7.Location = $System_Drawing_Point
$button7.Name = \&quot;button7\&quot;
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 68
$System_Drawing_Size.Width = 79
$button7.Size = $System_Drawing_Size
$button7.TabIndex = 6
$button7.Text = \&quot;7\&quot;
$button7.UseVisualStyleBackColor = $True
$button7.add_click({$textBox1.Text += \&quot;7\&quot;})

$form1.Controls.Add($button7)


$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 207
$System_Drawing_Point.Y = 109
$button6.Location = $System_Drawing_Point
$button6.Name = \&quot;button6\&quot;
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 67
$System_Drawing_Size.Width = 77
$button6.Size = $System_Drawing_Size
$button6.TabIndex = 5
$button6.Text = \&quot;6\&quot;
$button6.UseVisualStyleBackColor = $True
$button6.add_click({$textBox1.Text += \&quot;6\&quot;})
$form1.Controls.Add($button6)

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 121
$System_Drawing_Point.Y = 109
$button5.Location = $System_Drawing_Point
$button5.Name = \&quot;button5\&quot;
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 68
$System_Drawing_Size.Width = 78
$button5.Size = $System_Drawing_Size
$button5.TabIndex = 4
$button5.Text = \&quot;5\&quot;
$button5.UseVisualStyleBackColor = $True
$button5.add_click({$textBox1.Text += \&quot;5\&quot;})
$form1.Controls.Add($button5)

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 36
$System_Drawing_Point.Y = 109
$button4.Location = $System_Drawing_Point
$button4.Name = \&quot;button4\&quot;
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 68
$System_Drawing_Size.Width = 79
$button4.Size = $System_Drawing_Size
$button4.TabIndex = 3
$button4.Text = \&quot;4\&quot;
$button4.UseVisualStyleBackColor = $True
$button4.add_click({$textBox1.Text += \&quot;4\&quot;})
$form1.Controls.Add($button4)

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 206
$System_Drawing_Point.Y = 35
$button3.Location = $System_Drawing_Point
$button3.Name = \&quot;button3\&quot;
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 68
$System_Drawing_Size.Width = 79
$button3.Size = $System_Drawing_Size
$button3.TabIndex = 2
$button3.Text = \&quot;3\&quot;
$button3.UseVisualStyleBackColor = $True
$button3.add_click({$textBox1.Text += \&quot;3\&quot;})
$form1.Controls.Add($button3)

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 121
$System_Drawing_Point.Y = 36
$button2.Location = $System_Drawing_Point
$button2.Name = \&quot;button2\&quot;
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 67
$System_Drawing_Size.Width = 79
$button2.Size = $System_Drawing_Size
$button2.TabIndex = 1
$button2.Text = \&quot;2\&quot;
$button2.UseVisualStyleBackColor = $True
$button2.add_click({$textBox1.Text += \&quot;2\&quot;})
$form1.Controls.Add($button2)

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 36
$System_Drawing_Point.Y = 35
$button1.Location = $System_Drawing_Point
$button1.Name = \&quot;button1\&quot;
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 68
$System_Drawing_Size.Width = 79
$button1.Size = $System_Drawing_Size
$button1.TabIndex = 0
$button1.Text = \&quot;1\&quot;
$button1.UseVisualStyleBackColor = $True
$button1.add_click({$textBox1.Text += \&quot;1\&quot;})
$form1.Controls.Add($button1)

$textBox1.DataBindings.DefaultDataSourceUpdateMode = 0
$textBox1.Font = New-Object System.Drawing.Font(\&quot;Microsoft Sans Serif\&quot;,20.25,0,3,0)
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 35
$System_Drawing_Point.Y = 320
$textBox1.Location = $System_Drawing_Point
$textBox1.Name = \&quot;textBox1\&quot;
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 50
$System_Drawing_Size.Width = 227
$textBox1.Size = $System_Drawing_Size
$textBox1.TabIndex = 1

$form1.Controls.Add($textBox1)

$InitialFormWindowState = $form1.WindowState
$form1.add_Load($OnLoadForm_StateCorrection)
$form1.ShowDialog()| Out-Null



[/code:1]

Connexion ou Créer un compte pour participer à la conversation.

Temps de génération de la page : 0.171 secondes
Propulsé par Kunena