PPC开发,窗体添加背景图片

其实很简单首先添加背景图片到所在工程,设置为嵌入式资源。接着获取嵌入式图片资源,覆写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);
        }
Tag标签: Winform
posted @ 2008-04-16 17:31 tatung zhang 阅读(272) 评论(0)  编辑 收藏

标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
该文被作者在 2008-04-19 21:08 编辑过


相关链接: