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);
        }
原文地址:https://www.cnblogs.com/datong/p/1156617.html