Calculator GUI solution

 (Calculator GUI) Create the GUI for the calculator as shown in Fig. 2.42.


Fig. 2.42. Calculator GUI.

a) Manipulating the Form’s properties. Change the Text property of the Formto Calculator. Change the Font property to 9pt Segoe UI. Change the Sizeproperty of the Form to 258, 210.

b) Adding a TextBox to the Form. Set the TextBox’s Text property in theProperties 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 theTextBox.

c) 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 toFixed3D to make the inside of the Panel appear recessed. Change the Sizeproperty to 90, 120. This Panel will contain the calculator’s numeric keys.

d) Adding the second Panel to the Form. Change the Panel’s BorderStyleproperty to Fixed3D. Change the Size property to 62, 120. This Panel will contain the calculator’s operator keys.

e) Adding the third (and last) Panel to the Form. Change the Panel’sBorderStyle property to Fixed3D. Change the Size property to 54, 62. ThisPanel contains the calculator’s C (clear) and C/A (clear all) keys.

f) Adding Buttons to the Form. There are 20 Buttons on the calculator. Add aButton to the Panel by dragging and dropping it on the Panel. Change the Textproperty 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 theButtons, 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 Buttonhas size 54, 23. The + Button is sized 23, 81. The C (clear) and C/A (clear all)Buttons are sized 44, 23.
Powered by