有關winform中彈出模態表單,會在狀態列出現的變相解決方式

來源:互聯網
上載者:User

新的項目是一個Winform(MDI)的,中間會用到彈出模態子表單修改完後回到父表單.由於在使用了模態表單會導致在狀態列有很多表單的.這樣做很不雅觀.因此對彈出模態表單進行了一個變相的解決.
這裡不再具體的解釋,看測試代碼吧!希望對新手有所協助.

 1//Form2(子表單)
 2public event dgSample CallWrite;
 3public  delegate void dgSample(string name);
 4private void button1_Click(object sender, System.EventArgs e)
 5{
 6    CallWrite(textBox1.Text.Trim());
 7    this.Close();
 8}
 9
10//Form1(父表單)
11private void button1_Click(object sender, System.EventArgs e)
12{
13    Form2 frm = new Form2();
14    frm.CallWrite += new SampleWindows3.Form2.dgSample(WriteText);
15    frm.Show();
16}
17
18private void WriteText(string name)
19{
20    textBox1.Text = name;
21}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.