BMI Form1 Body Mass Index textBox3-4 (readonly) trackBar1

Slides:



Advertisements
Similar presentations
Creating web service (and client application) with Visual Studio 2008 Create web service project New project->web->ASP.NET web service application (with.
Advertisements

Click 98 bmi 1,75 kg m 98 bmi 1,75 kg m 32 Applet for calculation of body mass index.
Expression ISYS 350. Performing Calculations Basic calculations such as arithmetic calculation can be performed by math operators OperatorName of the.
Session 08: Architecture Controllers or Managers Graphical User Interface (GUI) FEN AK - IT Softwarekonstruktion.
Programming Interface Controls ISYS 350. User Interface Controls Form MessageBox Common Controls: –Button, TextBox, MaskedTextBox, List Box, Option Button,
By Szeto CYVisual C# Text form1Clock (label1) lblHH00 (label2) lblMM00 (label3) lblSS00 label4: label5: timer1Interval 500 Enabled true 按照下表,更改各控制項.
Intro to More Controls in C#. C# Demonstration We already touched on labels and buttons Ad-hoc demo of controls – Textboxes Multiline – Checkbox – Radiobutton.
Intro to More Controls in C#. C# Demonstration We already touched on labels and buttons Ad-hoc demo of controls – Textboxes Multiline – Checkbox – Radiobutton.
Lecture 16: Multithreaded Programming. public partial class Form1 : Form { Thread ct; Thread rt; public static int circle_sleep = 0; public static int.
Decision Structure - 1 ISYS 350. Decision: Action based on condition Examples Simple condition: – If total sales exceeds $300 then applies 5% discount;
Decision Structure - 2 ISYS 350. Complex Condition with Logical Operators The logical AND operator (&&) and the logical OR operator (||) allow you to.
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College
Programming Interface Controls ISYS 350. User Interface Controls Form MessageBox Common Controls: –Button, TextBox, MaskedTextBox, List Box, Option Button,
Command Object’s ExecuteNonQuery Method ISYS 512.
Decision Structure - 2 ISYS 350. Complex Condition with Logical Operators The logical AND operator (&&) and the logical OR operator (||) allow you to.
Programming Interface Controls ISYS 350. User Interface Controls Form MessageBox Common Controls: –Button, TextBox, MaskedTextBox, List Box, Option Button,
Created by Alia Al-Abdulkarim 2008 Visual Basic Vs. Java.
Architecture Multi Layered Architecture (n-tier): Application: Model Controllers Database Access Graphical User Interface (GUI): Forms, components, controls.
1 Working with Controls at Run Time. 2 Objectives You will be able to Add controls to a Windows form at run time. Modify controls at run time.
Decision Structure - 1 ISYS 350. Decision: Action based on condition Examples Simple condition: – If total sales exceeds $300 then applies 5% discount;
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
Coding ADO.Net DataSet Objects ISYS 512. DataSet Object A DataSet object can hold several tables and relationships between tables. A DataSet is a set.
Introduction to Methods ISYS 350. Methods Methods can be used to break a complex program into small, manageable pieces – This approach is known as divide.
Programming Interface Controls ISYS 350. User Interface Controls Form MessageBox Common Controls: –Button, TextBox, MaskedTextBox, List Box, Option Button,
Programming Interface Controls ISYS 350. User Interface Controls Form MessageBox Common Controls: –Button, TextBox, MaskedTextBox, List Box, Option Button,
Array, ArrayList and List ISYS 350. Array An array allows you to store a group of items of the same type together. Processing a large number of items.
Windows form programming. namespace MyNamespace { public class MyForm : System.Windows.Forms.Form { public MyForm() { this.Text = "Hello Form"; }
Decision Structure - 2 ISYS 350.
Expression ISYS 350.
Decision Structure ISYS 350.
Computing with C# and the .NET Framework
Array ISYS 350.
Decision Structure - 1 ISYS 350.
Loops ISYS 350.
Expression ISYS 350.
Programming Interface Controls
Programming Interface Controls
Decision Structure - 2 ISYS 350.
Array ISYS 350.
البرمجة بلغة فيجول بيسيك
Array ISYS 350.
Decision Structure - 1 ISYS 350.
مراحل كتابة البرنامج بلغة فيجول بيسك ستديو
Array ISYS 350.
Work with Data and Decision Structure
Decision Structure - 2 ISYS 350.
Array ISYS 350.
מבוא לתכנות בWINDOWS ב#C
Example: Checking for correct UK Postcode
Expression ISYS 350.
Decision Structures ISYS 350.
Expression ISYS 350.
Decision Structure - 2 ISYS 350.
Decision Structure - 2 ISYS 350.
Decision Structure - 1 ISYS 350.
Control Structures Part C – Groups of Controls
Decision Structure - 2 ISYS 350.
Loops ISYS 350.
Expression ISYS 350.
Decision Structure - 1 ISYS 350.
Array ISYS 350.
Expression ISYS 350.
Programming Interface Controls
AB form1 Multiplication textBox1 12 textBox2 34 textBox3
Creating Controls Dynamically in C#
label1 Name label2 Time (0-23) textBox1 textBox2 textBox3 button1
P(1) = P(2) = P(3) = P(4) = P(5) = 0.166
Command Object’s ExecuteNonQuery Method
Poker2.jpg Poker14.jpg int num1, num2;
form1 Runner pictureBox1 imageList1 timer1 label1 原地跑步計時 label2 共用了…秒
Presentation transcript:

BMI Form1 Body Mass Index textBox3-4 (readonly) trackBar1 trackBar1, trackBar2 Form1 Body Mass Index textBox3-4 (readonly) trackBar1 min(400),max(1000) smallchange trackBar2 min(150),max(190) radioButton1 男 checked radioButton2 女 radioButton1,2 label1, …, label4 textBox1, …, textBox4 by Szeto CY Visual C# 2008

雙按 (trackBar1,2),並加入以下程式碼: 捲動/拉動 private void trackBar1_Scroll(object sender, EventArgs e) { double wt = trackBar1.Value/10.0; double ht = trackBar2.Value/100.0; double bmi = wt/ht/ht; textBox1.Text = wt.ToString("0.0"); textBox2.Text = ht.ToString("0.0"); textBox3.Text = bmi.ToString("0.00"); calculateBMI(); } 數字轉文字 改變 textBox1,2,3 by Szeto CY Visual C# 2008

private void calculateBMI() { int n1=20, n2=25, n3=30; double wt = double.Parse(textBox1.Text); double ht = double.Parse(textBox2.Text); double bmi = wt/ht/ht; if (radioButton2.checked){ n1--; n2--; n3--; } textBox4.BackColor = Color.Lavender; if (bmi… else if (bmi < n2){ textBox4.Text = "正常"; textBox4.BackColor = Color.LightGreen; else if (bmi… else … 文字轉數字 BMI=wtht² by Szeto CY Visual C# 2008

private void Form1_Load(object sender, EventArgs e) { trackBar1.Value = 550; trackBar2.Value = 165; calculateBMI(); } private void radioButton1_CheckedChanged (object sender, EventArgs e) { calculateBMI(); } private void radioButton2_CheckedChanged (object sender, EventArgs e) by Szeto CY Visual C# 2008