Advertisement
Guest User

Untitled

a guest
Jan 21st, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.28 KB | None | 0 0
  1. [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
  2. [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
  3.  
  4. #Platfrom
  5. $Taschenrechner = New-Object System.Windows.Forms.Form
  6. $Taschenrechner.StartPosition = "CenterScreen"
  7. $Taschenrechner.Size = New-Object System.Drawing.Size(470,400)
  8. $Taschenrechner.Text = "Taschenrechner"
  9.  
  10. #Titel
  11. $Titel = New-Object System.Windows.Forms.Label
  12. $Titel.Location = New-Object System.Drawing.Size(70,10)
  13. $Titel.Size = New-Object System.Drawing.Size(360,50)
  14. $Font = New-Object System.Drawing.Font("Arial",30,[System.Drawing.FontStyle]::Regular)
  15. $Titel.Font = $Font
  16. $Titel.Text = "Taschenrechner"
  17. $Titel.Name = "Taschenrechner"
  18. $Taschenrechner.Controls.Add($Titel)
  19.  
  20. #Textfeld
  21. $Textfeld= New-Object System.Windows.Forms.TextBox
  22. $Textfeld.Location = New-Object System.Drawing.Size(25,100)
  23. $Textfeld.Size = New-Object System.Drawing.Size(100,100)
  24. $Textfeld.Width = (400)
  25. $Taschenrechner.Controls.Add($Textfeld)
  26.  
  27. #1
  28. $button1 = New-Object System.Windows.Forms.Button
  29. $button1.Location = New-Object System.Drawing.Size(25,120)
  30. $button1.Size = New-Object System.Drawing.Size(100,50)
  31. $button1.Add_Click({$Textfeld.Text+='1'})
  32. $button1.Text = "1"
  33. $button1.Name = "1"
  34. $Taschenrechner.Controls.Add($button1)
  35.  
  36. #2
  37. $button2 = New-Object System.Windows.Forms.Button
  38. $button2.Location = New-Object System.Drawing.Size(125,120)
  39. $button2.Size = New-Object System.Drawing.Size(100,50)
  40. $button2.Add_Click({$Textfeld.Text+='2'})
  41. $button2.Text = "2"
  42. $button2.Name = "2"
  43. $Taschenrechner.Controls.Add($button2)
  44.  
  45. #3
  46. $button3 = New-Object System.Windows.Forms.Button
  47. $button3.Location = New-Object System.Drawing.Size(225,120)
  48. $button3.Size = New-Object System.Drawing.Size(100,50)
  49. $button3.Add_Click({$Textfeld.Text+='3'})
  50. $button3.Text = "3"
  51. $button3.Name = "3"
  52. $Taschenrechner.Controls.Add($button3)
  53.  
  54. #4
  55. $button4 = New-Object System.Windows.Forms.Button
  56. $button4.Location = New-Object System.Drawing.Size(25,170)
  57. $button4.Size = New-Object System.Drawing.Size(100,50)
  58. $button4.Add_Click({$Textfeld.Text+='4'})
  59. $button4.Text = "4"
  60. $button4.Name = "4"
  61. $Taschenrechner.Controls.Add($button4)
  62.  
  63. #5
  64. $button5 = New-Object System.Windows.Forms.Button
  65. $button5.Location = New-Object System.Drawing.Size(125,170)
  66. $button5.Size = New-Object System.Drawing.Size(100,50)
  67. $button5.Add_Click({$Textfeld.Text+='5'})
  68. $button5.Text = "5"
  69. $button5.Name = "5"
  70. $Taschenrechner.Controls.Add($button5)
  71.  
  72. #6
  73. $button6 = New-Object System.Windows.Forms.Button
  74. $button6.Location = New-Object System.Drawing.Size(225,170)
  75. $button6.Size = New-Object System.Drawing.Size(100,50)
  76. $button6.Add_Click({$Textfeld.Text+='6'})
  77. $button6.Text = "6"
  78. $button6.Name = "6"
  79. $Taschenrechner.Controls.Add($button6)
  80.  
  81. #7
  82. $button7 = New-Object System.Windows.Forms.Button
  83. $button7.Location = New-Object System.Drawing.Size(25,220)
  84. $button7.Size = New-Object System.Drawing.Size(100,50)
  85. $button7.Add_Click({$Textfeld.Text+='7'})
  86. $button7.Text = "7"
  87. $button7.Name = "7"
  88. $Taschenrechner.Controls.Add($button7)
  89.  
  90. #8
  91. $button8 = New-Object System.Windows.Forms.Button
  92. $button8.Location = New-Object System.Drawing.Size(125,220)
  93. $button8.Size = New-Object System.Drawing.Size(100,50)
  94. $button8.Add_Click({$Textfeld.Text+='8'})
  95. $button8.Text = "8"
  96. $button8.Name = "8"
  97. $Taschenrechner.Controls.Add($button8)
  98.  
  99. #9
  100. $button9 = New-Object System.Windows.Forms.Button
  101. $button9.Location = New-Object System.Drawing.Size(225,220)
  102. $button9.Size = New-Object System.Drawing.Size(100,50)
  103. $button9.Add_Click({$Textfeld.Text+='9'})
  104. $button9.Text = "9"
  105. $button9.Name = "9"
  106. $Taschenrechner.Controls.Add($button9)
  107.  
  108. #0
  109. $button0 = New-Object System.Windows.Forms.Button
  110. $button0.Location = New-Object System.Drawing.Size(25,270)
  111. $button0.Size = New-Object System.Drawing.Size(100,50)
  112. $button0.Add_Click({$Textfeld.Text+='0'})
  113. $button0.Text = "0"
  114. $button0.Name = "0"
  115. $Taschenrechner.Controls.Add($button0)
  116.  
  117. #Dezimalstelle
  118. $Punkt = New-Object System.Windows.Forms.Button
  119. $Punkt.Location = New-Object System.Drawing.Size(125,270)
  120. $Punkt.Size = New-Object System.Drawing.Size(100,50)
  121. $Punkt.Add_Click({$Textfeld.Text+='.'})
  122. $Punkt.Text = "."
  123. $Punkt.Name = "."
  124. $Taschenrechner.Controls.Add($Punkt)
  125.  
  126. #Gleich
  127. $gleich = New-Object System.Windows.Forms.Button
  128. $gleich.Location = New-Object System.Drawing.Size(225,270)
  129. $gleich.Size = New-Object System.Drawing.Size(100,50)
  130. $gleich.Text = "="
  131. $gleich.Name = "="
  132. $Taschenrechner.Controls.Add($gleich)
  133.  
  134. #Durch
  135. $durch = New-Object System.Windows.Forms.Button
  136. $durch.Location = New-Object System.Drawing.Size(325,120)
  137. $durch.Size = New-Object System.Drawing.Size(100,50)
  138. $durch.Text = "/"
  139. $durch.Name = "/"
  140. $Taschenrechner.Controls.Add($durch)
  141.  
  142. #Mal
  143. $mal = New-Object System.Windows.Forms.Button
  144. $mal.Location = New-Object System.Drawing.Size(325,170)
  145. $mal.Size = New-Object System.Drawing.Size(100,50)
  146. $mal.Text = "x"
  147. $mal.Name = "x"
  148. $Taschenrechner.Controls.Add($mal)
  149.  
  150. #Minus
  151. $minus = New-Object System.Windows.Forms.Button
  152. $minus.Location = New-Object System.Drawing.Size(325,220)
  153. $minus.Size = New-Object System.Drawing.Size(100,50)
  154. $minus.Text = "-"
  155. $minus.Name = "-"
  156. $Taschenrechner.Controls.Add($minus)
  157.  
  158. #Plus
  159. $plus = New-Object System.Windows.Forms.Button
  160. $plus.Location = New-Object System.Drawing.Size(325,270)
  161. $plus.Size = New-Object System.Drawing.Size(100,50)
  162. $plus.Text = "+"
  163. $plus.Name = "+"
  164. $Taschenrechner.Controls.Add($plus)
  165.  
  166. [void] $Taschenrechner.ShowDialog()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement