zoukankan      html  css  js  c++  java
  • WinForm中如何设置MDI父窗体的背景图片

    在WinForm编程中大家可以想要在MDI父窗体中插入一张背景图片,下面给出实现方法:
    首先定义一个MdiClient变量
    private System.Windows.Forms.MdiClient mdiClient;
    在Mdi父窗体的构造函数中添加如下代码:
                //
                
    //准备获取MdiClient
                
    //
                int iCnt=this.Controls.Count;
                
    for(int i=0;i<this.Controls.Count;i++)
                
    {
                    
    if(this.Controls[i].GetType().ToString()=="System.Windows.Forms.MdiClient")
                    
    {
                        
    this.mdiClient=(System.Windows.Forms.MdiClient)this.Controls[i];
                        
    break;
                    }

                }

                
    string fbImage = Application.StartupPath + "\\Images\\backGround.jpg";
                
    if(File.Exists(fbImage))
                
    {
                    Bitmap bm 
    = new Bitmap(fbImage);
                    
    this.mdiClient.BackgroundImage = bm;
                }
    其中fbImage是你要设置的背景图片
  • 相关阅读:
    解决span中的内容不换行
    javascript中apply、call和bind的区别
    vuex及其属性应用
    55.动态加载Html
    58.圆角图片
    57.动态添加子View(Java/XML两种方式)
    56.Java与js交互
    59.仿微信的图片浏览器
    64.判断当前线程是否是主线程
    61.自定义Indicator
  • 原文地址:https://www.cnblogs.com/wpwen/p/399930.html
Copyright © 2011-2022 走看看