Using Menu Strip 2 Using Context Menu Strip

  • Slides: 26
Download presentation

程式Using. Menu. Strip畫面 2

程式Using. Menu. Strip畫面 2

程式Using. Context. Menu. Strip畫 面 5

程式Using. Context. Menu. Strip畫 面 5

程式Using. Dialog. Form畫面 8

程式Using. Dialog. Form畫面 8

Main. Form. cs (1/2) using System; using System. Collections. Generic; using System. Component. Model;

Main. Form. cs (1/2) using System; using System. Collections. Generic; using System. Component. Model; using System. Data; using System. Drawing; using System. Text; using System. Windows. Forms; namespace Using. Dialog. Form { public partial class Main. Form : Form { public Main. Form() { Initialize. Component(); } 10

Main. Form. cs (2/2) private void 輸入表格Tool. Strip. Menu. Item_Click(object sender, Event. Args e)

Main. Form. cs (2/2) private void 輸入表格Tool. Strip. Menu. Item_Click(object sender, Event. Args e) { //***************** Dialog diag = new Dialog(); diag. Show. Dialog(); //***************** } } } 11

Dialog. cs (1/3) using System; using System. Collections. Generic; using System. Component. Model; using

Dialog. cs (1/3) using System; using System. Collections. Generic; using System. Component. Model; using System. Data; using System. Drawing; using System. Text; using System. Windows. Forms; namespace Using. Dialog. Form { public partial class Dialog : Form { //****************** int[ , ] table = new int[2, 3]; //****************** public Dialog() { Initialize. Component(); } 12

Dialog. cs (2/3) private void button 1_Click(object sender, Event. Args e) { //********************** table[0,

Dialog. cs (2/3) private void button 1_Click(object sender, Event. Args e) { //********************** table[0, 0] = Convert. To. Int 32(text. Box 1. Text); table[0, 1] = Convert. To. Int 32(text. Box 2. Text); table[0, 2] = Convert. To. Int 32(text. Box 3. Text); table[1, 0] = Convert. To. Int 32(text. Box 4. Text); table[1, 1] = Convert. To. Int 32(text. Box 5. Text); table[1, 2] = Convert. To. Int 32(text. Box 6. Text); Message. Box. Show(table[0, 0]. To. String()+ "t" + table[0, 1]. To. String()+ "t" + table[0, 2]. To. String()+ "n" + table[1, 0]. To. String()+ "t" + table[1, 1]. To. String()+ "t" + table[1, 2]. To. String() + "n"); //**********************13 }

Dialog. cs (3/3) private void button 2_Click(object sender, Event. Args e) { //***************** Dispose();

Dialog. cs (3/3) private void button 2_Click(object sender, Event. Args e) { //***************** Dispose(); //***************** } } } 14

程式Using. GUI畫面 16

程式Using. GUI畫面 16

Main. Form. cs (1/3) using System; using System. Collections. Generic; using System. Component. Model;

Main. Form. cs (1/3) using System; using System. Collections. Generic; using System. Component. Model; using System. Data; using System. Drawing; using System. Text; using System. Windows. Forms; namespace Using. GUI { public partial class Main. Form : Form { //***************** Table t = new Table(); //***************** 17

Main. Form. cs (2/3) public Main. Form() { Initialize. Component(); } private void 輸入表格Tool.

Main. Form. cs (2/3) public Main. Form() { Initialize. Component(); } private void 輸入表格Tool. Strip. Menu. Item_Click( object sender, Event. Args e) { //***************** Dialog diag = new Dialog(); diag. Show. Dialog(); t. Content = diag. Content; 計算Tool. Strip. Menu. Item. Enabled = true; //***************** } 18

Main. Form. cs (3/3) private void 計算Tool. Strip. Menu. Item_Click( object sender, Event. Args

Main. Form. cs (3/3) private void 計算Tool. Strip. Menu. Item_Click( object sender, Event. Args e) { //***************** Output output = new Output(); output. Do. Computation(t); output. Show. Dialog(); //***************** } } } 19

Dialog. cs (1/4) using using System; System. Collections. Generic; System. Component. Model; System. Data;

Dialog. cs (1/4) using using System; System. Collections. Generic; System. Component. Model; System. Data; System. Drawing; System. Text; System. Windows. Forms; namespace Using. GUI { public partial class Dialog : Form { //****************** int[ , ] table = new int[2, 3]; //****************** 20

Dialog. cs (2/4) public Dialog() { Initialize. Component(); } private void button 1_Click( object

Dialog. cs (2/4) public Dialog() { Initialize. Component(); } private void button 1_Click( object sender, Event. Args e) { //********************** table[0, 0] = Convert. To. Int 32(text. Box 1. Text); table[0, 1] = Convert. To. Int 32(text. Box 2. Text); table[0, 2] = Convert. To. Int 32(text. Box 3. Text); table[1, 0] = Convert. To. Int 32(text. Box 4. Text); table[1, 1] = Convert. To. Int 32(text. Box 5. Text); table[1, 2] = Convert. To. Int 32(text. Box 6. Text); 21

Dialog. cs (3/4) Message. Box. Show(table[0, 0]. To. String()+ "t" + table[0, 1]. To.

Dialog. cs (3/4) Message. Box. Show(table[0, 0]. To. String()+ "t" + table[0, 1]. To. String()+ "t" + table[0, 2]. To. String()+ "n" + table[1, 0]. To. String()+ "t" + table[1, 1]. To. String()+ "t" + table[1, 2]. To. String()+ "n"); Dispose(); //********************** } private void button 2_Click( object sender, Event. Args e) { //********************** Dispose(); //********************** } 22

Dialog. cs (4/4) //*********************** public int[, ] Content { get { return table; }

Dialog. cs (4/4) //*********************** public int[, ] Content { get { return table; } } //*********************** } } 23

Output. cs (1/3) using using System; System. Collections. Generic; System. Component. Model; System. Data;

Output. cs (1/3) using using System; System. Collections. Generic; System. Component. Model; System. Data; System. Drawing; System. Text; System. Windows. Forms; namespace Using. GUI { public partial class Output : Form { public Output() { Initialize. Component(); } 24

Output. cs (2/3) private void Output_Load( object sender, Event. Args e) {} private void

Output. cs (2/3) private void Output_Load( object sender, Event. Args e) {} private void button 1_Click( object sender, Event. Args e) { //********************** Dispose(); //********************** } //*********************** public void Do. Computation(Table t) { int[, ] table = t. Content; int[] row. Sum = t. Get. Row. Sum(); int[] col. Sum = t. Get. Col. Sum(); int total. Sum = t. Get. Total. Sum(); 25

Output. cs (3/3) label 5. Text = table[0, 0]. To. String(); label 6. Text

Output. cs (3/3) label 5. Text = table[0, 0]. To. String(); label 6. Text = table[0, 1]. To. String(); label 7. Text = table[0, 2]. To. String(); label 8. Text = row. Sum[0]. To. String(); label 9. Text = table[1, 0]. To. String(); label 10. Text = table[1, 1]. To. String(); label 11. Text = table[1, 2]. To. String(); label 12. Text = row. Sum[1]. To. String(); label 13. Text = col. Sum[0]. To. String(); label 14. Text = col. Sum[1]. To. String(); label 15. Text = col. Sum[2]. To. String(); label 16. Text = total. Sum. To. String(); } //************************ } } 26