小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

當一個FORM窗體把IsMidContainer屬性改為TRUE的時候,背景色就變成深灰,怎樣改變其背景色.謝謝.

 qxy2215 2016-12-11

當一個FORM窗體把IsMidContainer屬性改為TRUE的時候,背景色就變成深灰,怎樣改變其背景色.謝謝. [問題點數(shù):50分,結帖人eric88]

eric88
關注
eric88
eric88
本版等級:T2
結帖率:100%
樓主 發(fā)表于: 2006-10-19 15:20:50
RT
更多 0 分享到:
回復次數(shù):6
tjvictor
關注
tjvictor
灰太狼
本版等級:T6
#1 得分:10 回復于: 2006-10-19 15:29:29
private System.Windows.Forms.MdiClient MyClient = null;
foreach(System.Windows.Forms.Control myControl in this.Controls)
{
   if(myControl.GetType().ToString() == "System.Windows.Forms.MdiClient")
{
    MyClient = (System.Windows.Forms.MdiClient)myControl;
    break;
}
}
if ( MyClient != null )
MyClient.BackgroundImage = Image.FromFile( "aaa.gif" ) ;
eric88
關注
eric88
eric88
本版等級:T2
#2 得分:0 回復于: 2006-10-19 15:39:52
已經(jīng)解決.
我的方法是在FORM上加了一個panel填充到整個FORM讓panel當背景.就可以了.

謝謝樓上的.
gezichong
關注
gezichong
gezichong
本版等級:T5
#3 得分:10 回復于: 2006-10-19 15:42:35
msdn幫助里面的..
Create a Sample Windows Application by Using Visual C# .NET
Create a new Visual C# .NET Windows application. Form1 is created by default.
Click the form, and then, on the View menu, select Properties Window to view the properties for the form.
Set the BackColor property to the color that you want (such as LightBlue).
Set the IsMDIContainer property to True. Note that the background color of the form changes to the color that the Application Background color is set to in Control Panel.
Set the WindowState property to Maximized.
Double-click the form to view its code window.
Paste the following code into the form's Load event handler:
MdiClient ctlMDI;

// Loop through all of the form's controls looking
// for the control of type MdiClient.
foreach (Control ctl in this.Controls)
{
   try
   {
      // Attempt to cast the control to type MdiClient.
      ctlMDI = (MdiClient) ctl;

      // Set the BackColor of the MdiClient control.
      ctlMDI.BackColor = this.BackColor;
   }
   catch (InvalidCastException exc)
   {
      // Catch and ignore the error if casting failed.
   }          
}

// Display a child form to show this is still an MDI application.
Form2 frm = new Form2();
frm.MdiParent = this;
frm.Show();

On the Project menu, click Add Windows Form. 
Accept the default name Form2.cs, and then click Open.
Press F5 to run the application.
Note that the MDI parent form loads and has a light blue background.

eric88
關注
eric88
eric88
本版等級:T2
#4 得分:0 回復于: 2006-10-19 15:57:01
TO gezichong(鴿子蟲) :
這個方法好.
我把背景色改成下面這個了.就跟C#默認的控件顔色一樣.

ctlMDI.BackColor = System.Drawing.SystemColors.Control;
SOFT_LIN
關注
SOFT_LIN
SOFT_LIN
本版等級:T1
#5 得分:10 回復于: 2006-12-14 15:09:44
直接設置子窗體就可以了!
SOFT_LIN
關注
SOFT_LIN
SOFT_LIN
本版等級:T1
#6 得分:20 回復于: 2006-12-14 15:15:56
MdiClient MDclient;
   
   foreach (Control ctl in this.Controls)
   {
    try
    {
     MDclient= (MdiClient) ctl;

     // 設置MDI窗體的背景色

     MDclient.BackColor = System.Drawing.SystemColors.Control;
    }
    catch 
    {
      }           
   }

    本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內容均由用戶發(fā)布,不代表本站觀點。請注意甄別內容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權內容,請點擊一鍵舉報。
    轉藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多