背景图应该随窗口的大小改变才对,当然窗口是随屏幕大小改变
重写窗口的paint方法

解决方案 »

  1.   

    你可以在form上添加picturebox, dock为fill; 把picturebox的picture作为form的backgroundimage并设置picturebox的picture为自动符合picturebox的大小;以上为一点点变通的建议;
    有好的方法再告之;
      

  2.   

    由于我现在的工作用vb;所以很多时候会把一些东西和c#的混淆;
    这才是c#的代码:
    this.pictureBox1 = new System.Windows.Forms.PictureBox();
    this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
    this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
    this.Controls.Add(this.pictureBox1);
      

  3.   

    我把图片设置为主窗口的背景图系统就不让改变图的尺寸大小,用pictureBox图片又会遮着子窗口,真是急死人了.各位帮帮忙解决一下,谢谢!
      

  4.   

    为什么会遮盖子窗口呢?
    把pictirebox置与最底层不行吗?不太懂你的意思;
      

  5.   

    csxtu(喝少点,喝好点),pictirebox置与最底层也还是会遮盖子窗口,就是说打开子窗口后子窗口是在pictirebox的底下
      

  6.   

    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;namespace WindowsApplication42
    {
    /// <summary>
    /// Form1 的摘要说明。
    /// </summary>
    public class Form1 : System.Windows.Forms.Form
    {
    /// <summary>
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.Container components = null;
    private System.Windows.Forms.Button button1;
                                         Bitmap myBitmap = new Bitmap(@"E:\MyPics\xia\图片 002.jpg");
    public Form1()
    {
    //
    // Windows 窗体设计器支持所必需的
    //
    InitializeComponent(); //
    // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
    //
    } /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if (components != null) 
    {
    components.Dispose();
    }
    }
    base.Dispose( disposing );
    } #region Windows 窗体设计器生成的代码
    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
    this.button1 = new System.Windows.Forms.Button();
    this.SuspendLayout();
    // 
    // button1
    // 
    this.button1.Location = new System.Drawing.Point(0, 0);
    this.button1.Name = "button1";
    this.button1.Size = new System.Drawing.Size(48, 24);
    this.button1.TabIndex = 1;
    this.button1.Text = "button1";
    this.button1.Click += new System.EventHandler(this.button1_Click);
    // 
    // Form1
    // 
    this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
    this.ClientSize = new System.Drawing.Size(292, 266);
    this.Controls.Add(this.button1);
    this.IsMdiContainer = true;
    this.Name = "Form1";
    this.Text = "Form1";
    this.Resize += new System.EventHandler(this.Form1_Resize);
    this.Load += new System.EventHandler(this.Form1_Load);
    this.ResumeLayout(false); }
    #endregion /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main() 
    {
    Application.Run(new Form1());

    }
    private void Form1_Resize(object sender,EventArgs e)
    {
           Bitmap backImage=new Bitmap(myBitmap,this.Width ,this.Height );
           this.BackgroundImage =backImage;
    } private void Form1_Load(object sender, System.EventArgs e)
    {
                                                         //看看这里;
    Bitmap backImage=new Bitmap(myBitmap,this.Width ,this.Height );
    this.BackgroundImage =backImage;
    } private void button1_Click(object sender, System.EventArgs e)
    {
    Form2 form2=new Form2 ();
    form2.MdiParent =this;
    form2.Show ();

    }
    }
      

  7.   

    我用2002时,加背景图,刷新特慢,不知道2003是不是好一点,我是这样做的
    一个解决方法:
    在主窗体里加入一个无边框的子窗体,在这个子窗体上加一个pictureBox:dock fill这个子窗体里
    public class Test : System.Windows.Forms.Form
    {
    public Test()
    {
    InitializeComponent();
    this.FormBorderStyle=FormBorderStyle.None;
    this.Dock=DockStyle.Fill
    this.Paint += new System.Windows.Forms.PaintEventHandler(this.Test_Paint);
    }private void Test_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
    {
    this.SendToBack();
    }
      

  8.   

    建议你用一个子窗口做为背景窗口,加点处理(用户不可以关闭也不可以改变大小)
    这样不但可以用pictrueobx显示图片,还可以加其他的东东,比如说桌面图标