Starting from:

$20

Calculator GUI solution

Create the GUI for the calculator as shown in Fig. 2.42.

* **__Manipulating the Form’s properties__**. Change the `Text` property of the Form to Calculator. Change the `Font` property to 9pt Segoe UI. Change the `Size` property of the Form to 258, 210.
* **__Adding a TextBox to the Form__**. Set the TextBox’s `Text` property in the Properties window to 0. Stretch the TextBox and position it as shown in Fig. 2.42. Set the `TextAlign` property to Right—this right aligns text displayed in the TextBox.
* **__Adding the first Panel to the Form__**. Panel controls are used to group other controls. Add a Panel to the Form. Change the Panel’s `BorderStyle` property to Fixed3D to make the inside of the Panel appear recessed. Change the `Size` property to 90, 120. This Panel will contain the calculator’s numeric keys.
* **__Adding the second Panel to the Form__**. Change the Panel’s `BorderStyle` property to Fixed3D. Change the `Size` property to 62, 120. This Panel will contain the calculator’s operator keys.
* **__Adding the third (and last) Panel to the Form__**. Change the Panel’s `BorderStyle` property to Fixed3D. Change the `Size` property to 54, 62. This Panel contains the calculator’s `C` (clear) and `C/A` (clear all) keys.
* **__Adding Buttons to the Form__**. There are 20 Buttons on the calculator. Add a Button to the Panel by dragging and dropping it on the Panel. Change the `Text` property of each Button to the calculator key it represents. The value you enter in the `Text` property will appear on the face of the Button. Finally, resize the Buttons, using their `Size` properties. Each Button labeled `0–9`, `*`, `/`, `-`, `=` and `.` should have a size of 23, 23. The `00` Button has size 52, 23. The `OFF` Button has size 54, 23. The `+` Button is sized 23, 81. The `C` (clear) and `C/A` (clear all) Buttons are sized 44, 23.

More products