在一个窗体上绘制背景图,是一项很有用的功能

首先在你的工程里添加背景图片,然后右击选择生成类型为嵌入式资源

记得添加名称空间
using System.Reflection;

然后获取嵌入式图片资源

1在窗体上绘背景图案private Image backgroundImage;


2在窗体上绘背景图案     backgroundImage = new    Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("BkgndImage.7009.gif"));  

 

 

最后一步就是绘制背景了

1在窗体上绘背景图案protected override void OnPaint(PaintEventArgs e)
2在窗体上绘背景图案在窗体上绘背景图案        在窗体上绘背景图案{
3在窗体上绘背景图案              e.Graphics.DrawImage(backgroundImage, this.ClientRectangle, new Rectangle(0, 0, this.backgroundImage.Width, this.backgroundImage.Height), GraphicsUnit.Pixel);
4在窗体上绘背景图案          }


相关文章:

  • 2021-12-19
  • 2022-12-23
  • 2021-12-07
  • 2022-01-15
  • 2021-11-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
相关资源
相似解决方案