Select All That Apply. Which Of The Following Name A Line In The Drawing?
This browser is no longer supported.
Upgrade to Microsoft Edge to have reward of the latest features, security updates, and technical support.
Tutorial: Create a math quiz WinForms app
In this series of 4 tutorials, y'all'll build a math quiz. The quiz contains 4 random math issues that a quiz taker tries to reply within a specified time.
The Visual Studio integrated development environment (IDE) provides the tools that you need to create the app. To learn more about this IDE, see Welcome to the Visual Studio IDE.
In this beginning tutorial, you learn how to:
- Create a Visual Studio project that uses Windows Forms.
- Add labels, a button, and other controls to a form.
- Set properties for the controls.
- Save and run your project.
Prerequisites
Y'all need Visual Studio to complete this tutorial. Visit the Visual Studio downloads page for a costless version.
Create your Windows Forms project
When you create a math quiz, the first step is to create a Windows Forms App project.
-
Open Visual Studio.
-
On the card bar, select File > New > Project.
-
On the left side of the New Project dialog box, select either Visual C# or Visual Bones, and then select Windows Desktop.
-
In the project templates list, select Windows Forms App (.Internet Framework). Name the new form MathQuiz, and then select OK.
Note
If you don't run into the Windows Forms App (.NET Framework) template, utilise Visual Studio Installer to install the .NET desktop evolution workload.
For more information, see Install Visual Studio.
-
Open Visual Studio.
-
On the start window, select Create a new project.
-
In the Create a new projection window, search for Windows Forms. Then select Desktop from the Projection type list.
-
Select the Windows Forms App (.Net Framework) template for either C# or Visual Bones, and then select Next.
Annotation
If yous don't see the Windows Forms App (.NET Framework) template, you lot tin can install it from the Create a new project window. In the Not finding what you're looking for? bulletin, select Install more tools and features.
Side by side, in Visual Studio Installer, select .Cyberspace desktop development.
Select Change in Visual Studio Installer. You might be prompted to save your work. Next, select Continue to install the workload.
-
In the Configure your new projection window, proper noun your project MathQuiz, and then select Create.
-
Open up Visual Studio.
-
On the start window, select Create a new project.
-
In the Create a new project window, search for Windows Forms. And so select Desktop from the Project type list.
-
Select the Windows Forms App (.Internet Framework) template for either C# or Visual Bones, and so select Next.
Note
If you don't see the Windows Forms App (.NET Framework) template, you tin install it from the Create a new project window. In the Non finding what yous're looking for? message, select Install more tools and features.
Side by side, in Visual Studio Installer, select .Cyberspace desktop development.
Select Modify in Visual Studio Installer. You might be prompted to relieve your piece of work. Next, select Continue to install the workload.
-
In the Configure your new project window, name your project MathQuiz, and then select Create.
Visual Studio creates a solution for your app. A solution is a container for all the projects and files that your app needs.
Set form properties
After you lot select your template and name your file, Visual Studio opens a form for you. This section shows you how to change some form properties.
-
In your project, select Windows Forms Designer. The designer tab is labeled Form1.cs [Pattern] for C# or Form1.vb [Design] for Visual Basic.
-
Select the course, Form1.
-
The Properties window now displays backdrop for the class. This window is ordinarily in the lower right corner of Visual Studio. If you don't see Properties, select View > Properties Window.
-
Find the Text holding in the Properties window. Depending on how the listing is sorted, you might need to scroll downward. Enter the value Math Quiz for the Text value, and and then select Enter.
Your grade at present has the text "Math Quiz" in its title bar.
Note
You can brandish properties by category or alphabetically. Employ the buttons on the Backdrop window to switch back and forth.
-
Alter the size of the form to 500 pixels wide by 400 pixels alpine.
Yous can resize the form by dragging its edges or drag handle until the correct size appears as the Size value in the Properties window. The drag handle is a minor white square in the lower-right corner of the form. You can as well resize the form by changing the values of the Size belongings.
-
Change the value of the FormBorderStyle holding to Fixed3D, and set up the MaximizeBox holding to False.
These values forbid quiz takers from resizing the form.
Create the time remaining box
The math quiz contains a box in the upper-right corner. That box shows the number of seconds that remain in the quiz. This section shows you how to use a characterization for that box. You'll add lawmaking for the countdown timer in a later tutorial in this series.
-
On the left side of the Visual Studio IDE, select the Toolbox tab. If yous don't see the toolbox, select View > Toolbox from the carte bar or Ctrl+Alt+X.
-
Select the Label control in the Toolbox, and so drag it onto the grade.
-
In the Properties box, gear up the following backdrop for the label:
- Set the (Name) to timeLabel.
- Change AutoSize to False so that you can resize the box.
- Change the BorderStyle to FixedSingle to draw a line around the box.
- Set the Size to 200, 30.
- Select the Text property, and then select the Backspace key to clear the Text value.
- Select the plus sign (+) adjacent to the Font property, and and so fix the Size to fifteen.75.
-
Motility the label to the upper-right corner of the form. When bluish spacer lines appear, use them to position the command on the form.
-
Add another Label control from the Toolbox, and then set its font size to fifteen.75.
-
Set up this characterization's Text holding to Fourth dimension Left.
-
Move the label then that it lines up to the left of the timeLabel label.
Add controls for the addition problem
The first office of the quiz is an addition problem. This section shows you how to use labels to display that problem.
-
Add a Label control from the Toolbox to the form.
-
In the Properties box, set the following properties for the label:
- Set the Text to ? (question mark).
- Set up AutoSize to Faux.
- Set the Size to 60, fifty.
- Set the font size to 18.
- Set TextAlign to MiddleCenter.
- Set the Location to fifty, 75 to position the control on the form.
- Set the (Name) to plusLeftLabel.
-
In the grade, select the plusLeftLabel label that you created. Copy the label past selecting either Edit > Copy or Ctrl+C.
-
Paste the label into the grade three times past selecting either Edit > Paste or Ctrl+V three times.
-
Adjust the iii new labels then that they are in a row to the right of the plusLeftLabel label.
-
Prepare the second label's Text property to + (plus sign).
-
Ready the 3rd label'south (Name) property to plusRightLabel.
-
Set the fourth characterization'southward Text belongings to = (equals sign).
-
Add a NumericUpDown control from the Toolbox to the class. You'll learn more nigh this kind of control later.
-
In the Properties box, set the post-obit properties for the NumericUpDown control:
- Set the font size to 18.
- Set the width to 100.
- Prepare the (Name) to sum.
-
Line upwardly the NumericUpDown control with the Label controls for the add-on problem.
Add together controls for the subtraction, multiplication, and division problems
Side by side, add together labels to the form for the remaining math issues.
-
Copy the iv Label controls and the NumericUpDown control that you created for the improver problem. Paste them into the form.
-
Move the new controls to line up below the addition controls.
-
In the Properties box, set the post-obit backdrop for the new controls:
- Set the (Proper name) of the get-go question-marker characterization to minusLeftLabel.
- Set the Text of the second label to - (minus sign).
- Set the (Proper noun) of the second question-mark label to minusRightLabel.
- Set the (Proper noun) of the NumericUpDown control to difference.
-
Copy the addition controls, and paste them two more times into the course.
-
For the third row:
- Set the (Proper noun) of the first question-marker label to timesLeftLabel.
- Set the Text of the 2nd label to × (multiplication sign). You tin re-create the multiplication sign from this tutorial and paste information technology onto the course.
- Set the (Proper name) of the second question-mark characterization to timesRightLabel.
- Set the (Proper noun) of the NumericUpDown command to product.
-
For the fourth row:
- Set the (Name) of the commencement question-mark characterization to dividedLeftLabel.
- Prepare the Text of the second label to ÷ (division sign). You lot tin can re-create the partitioning sign from this tutorial and paste information technology onto the form.
- Set the (Proper name) of the 2nd question-mark label to dividedRightLabel.
- Set the (Name) of the NumericUpDown control to caliber.
Add together a starting time push and set the tab-index order
This department shows you how to add a offset push button. You'll also specify the tabbing order of the controls. This ordering determines how the quiz taker moves from one command to the next past using the Tab key.
-
Add a Button control from the Toolbox to the form.
-
In the Properties box, set the post-obit backdrop of the Push:
- Set the (Name) to startButton.
- Set the Text to Starting time the quiz.
- Fix the font size to xiv.
- Set AutoSize to True, which causes the button to automatically resize to fit the text.
- Prepare the TabIndex to 0. This value makes the start button the get-go control to receive the focus.
-
Center the button almost the bottom of the form.
-
In the Properties box, gear up the TabIndex holding of each NumericUpDown control:
- Set the TabIndex of the sum NumericUpDown control to one.
- Gear up the TabIndex of the divergence NumericUpDown control to two.
- Set the TabIndex of the production NumericUpDown control to 3.
- Fix the TabIndex of the quotient NumericUpDown control to 4.
Run your app
The math issues don't work yet on your quiz. Simply you can withal run your app to check whether the TabIndex values function every bit you expect.
-
Use one of the following methods to salve your app:
- Select Ctrl+Shift+South.
- On the bill of fare bar, select File > Save All.
- On the toolbar, select the Save All button.
-
Employ ane of the following methods to run your app:
- Select F5.
- On the menu bar, select Debug > First Debugging.
- On the toolbar, select the Starting time button.
-
Select the Tab central a few times to see how the focus moves from one control to the next.
Next steps
Accelerate to the next tutorial to add together random math problems and an effect handler to your math quiz.
Feedback
Submit and view feedback for
Source: https://docs.microsoft.com/en-us/visualstudio/get-started/csharp/tutorial-windows-forms-math-quiz-create-project-add-controls
Posted by: henryrocklairling1983.blogspot.com
0 Response to "Select All That Apply. Which Of The Following Name A Line In The Drawing?"
Post a Comment