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是你要设置的背景图片
  • 相关阅读:
    操作系统复习
    Google hack语法
    c++的set重载运算符
    华为笔试题
    Flume+Kafka整合
    kafka相关知识点总结
    kafka中生产者和消费者API
    Kafka集群环境搭建
    Storm消息容错机制(ack-fail机制)
    Storm通信机制(了解)
  • 原文地址:https://www.cnblogs.com/wpwen/p/399930.html
Copyright © 2011-2022 走看看