1 / 4

按照下表,更改各控制項 Text 屬性 再按 F5 開始偵錯 ( 執行 )

按照下表,更改各控制項 Text 屬性 再按 F5 開始偵錯 ( 執行 ). 其他屬性 : BackColor BackgroundImage MaximumSize Font MinimumSize ForeColor Image SizeMode Enabled Size StartPosition TextAlign Text Visible. 雙按按鈕 (Submit) ,並加入以下程式碼:. private void button1_Click(object sender, EventArgs e) {

Download Presentation

按照下表,更改各控制項 Text 屬性 再按 F5 開始偵錯 ( 執行 )

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 按照下表,更改各控制項Text屬性 再按F5開始偵錯 (執行) 其他屬性: BackColor BackgroundImage MaximumSize Font MinimumSize ForeColor Image SizeMode Enabled Size StartPosition TextAlign Text Visible Visual C# 2008

  2. 雙按按鈕(Submit),並加入以下程式碼: private void button1_Click(object sender, EventArgs e) { txtMsg.Text = " Mr." + txtName.Text; } 右按,選檢視程式碼,修改程式碼: private void button1_Click(object sender, EventArgs e) { int hh = int.Parse(txtTime.Text); txtMsg.Text = hh.ToString("00"); } 修改程式碼: private void button1_Click(object sender, EventArgs e) { int hh = 999; txtMsg.Text = txtName.Text + hh; } Visual C# 2008

  3. 修改程式碼: private void button1_Click(object sender, EventArgs e) { int hh = int.Parse(txtTime.Text); } if (hh < 12)txtMsg.Text = "Good Morning"; else if (hh < 18)txtMsg.Text = "Good Afternoon"; elsetxtMsg.Text = "Good Evening"; txtMsg.Text += " Mr." + txtName.Text; 假若使用者沒有輸入時間,會如何? int hh = int.Parse(txtTime.Text); Visual C# 2008

  4. 修改程式碼: private void button1_Click(object sender, EventArgs e) { try { int hh = int.Parse(txtTime.Text); } catch { txtMsg.Text = "Error"; } } if (hh < 12)txtMsg.Text = "Good Morning"; else if (hh < 18)txtMsg.Text = "Good Afternoon"; elsetxtMsg.Text = "Good Evening"; txtMsg.Text += " Mr." + txtName.Text; Visual C# 2008

More Related