ComputerProgrammingand BasicSoftwareEngineering9 Building Graphical UserInterface9.3 CreatingaMultiple-FormInterface
Computer Programming and Basic Software Engineering 9 Building Graphical User Interface 9.3 Creating a Multiple-Form Interface
ComputerProgrammingandBasicSoftwareEngineering9 Building Graphical User InterfaceCreating a Multiple-Form InterfaceIt is common that an application may have more thanoneformEach form has its own GUIIn addition, one form may be invoked by anotherformTo add one more form to a project, we need to followthesteps below:1.Add one more form class toyour project2. Design theform layout3.Set the properties of the GUIs in the new form4. Update the program code of the original form
Computer Programming and Basic Software Engineering 9 Building Graphical User Interface Creating a Multiple-Form Interface • It is common that an application may have more than one form • In addition, one form may be invoked by another form • To add one more form to a project, we need to follow the steps below: 1. Add one more form class to your project 2. Design the form layout 3. Set the properties of the GUIs in the new form 4. Update the program code of the original form. Each form has its own GUI
ComputerProgrammingand BasicSoftwareEngineering9 Building Graphical UserInterfaceRadiobuttonExampleForml.口区Form2西口区Choose any one cardCSpadeAceHeartAceAdaClubAceDiamond Ace+Show CardOKWhenthebuttonshow Cardisclicked,Form2 will beshown
Computer Programming and Basic Software Engineering 9 Building Graphical User Interface Example When the button Show Card is clicked, Form2 will be shown Radio button
ComputerProgrammingandBasicSoftwareEngineering9 Building Graphical UserInterfaceStep1:Specification of the programl.A user is asked to select one and only one of thefourcards2. If the user does not check any of the radio button,no card will be shown3. If the user clicks the show Card button,anotherform(Form2)will be shownwith the selected card4.The user cannot access the original form (Form1)untilheclickstheOKbuttonofForm2.Form2isknown as the modal form5. If the user clicks on the picture, the card will togglebetween face-upand face-down
Computer Programming and Basic Software Engineering 9 Building Graphical User Interface • Step 1: Specification of the program 1. A user is asked to select one and only one of the four cards 2. If the user does not check any of the radio button, no card will be shown 3. If the user clicks the Show Card button, another form (Form2) will be shown with the selected card 4. The user cannot access the original form (Form1) until he clicks the OK button of Form2. Form2 is known as the modal form. 5. If the user clicks on the picture, the card will toggle between face-up and face-down
ComputerProgrammingand BasicSoftwareEngineering9 Building Graphical User InterfaceProject name:Chap9p5Step2:DevelopForm1Form1口XgroupBoxAll controlsChoose any one cardinside a groupHeartAceSpadeAcebox will beClubAceDiamondAcegrouped togetherradioButtonFor the radioShowCardbuttonsinsideagroup box, onlyMake suretheTabstoppropertyoftheoneofthemcanRadioButtonsareFalsebe selected
Computer Programming and Basic Software Engineering 9 Building Graphical User Interface Step 2: Develop Form1 groupBox All controls inside a group box will be grouped together radioButton For the radio buttons inside a group box, only one of them can be selected Project name: Chap9p5 Make sure the TabStop property of the RadioButtons are False