现在的位置: 首页 > 综合 > 正文

winfrom 窗体背景

2013年01月11日 ⁄ 综合 ⁄ 共 457字 ⁄ 字号 评论关闭

首先在项目属性--》资源  --》添加资源--》添加现有文件即可

  private Image bgImage;
        public Form1()
        {
            InitializeComponent();
            bgImage = new Bitmap(Properties.Resources.shq);
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            e.Graphics.DrawImage(bgImage, this.ClientRectangle, new Rectangle(0, 0, this.bgImage.Width, this.bgImage.Height), GraphicsUnit.Pixel);
        }

 

label1.BackColor = Color.Transparent;   把lable透明化

抱歉!评论已关闭.