其实很简单首先添加背景图片到所在工程,设置为嵌入式资源。接着获取嵌入式图片资源,覆写OnPaint绘制背景。
private Image bgImage;
public FormBase()
        
{
            bgImage
= new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("CMclient.Image.Img_BackGround.gif"));
        }

//绘制背景
        protected override void OnPaint(PaintEventArgs e)
        
{
            
base.OnPaint(e);
            e.Graphics.DrawImage(bgImage, 
this.ClientRectangle, new Rectangle(00this.bgImage.Width, this.bgImage.Height), GraphicsUnit.Pixel);
        }
posted on 2008-04-16 17:31  tatung zhang  阅读(917)  评论(0)    收藏  举报