RendererBackground() public static method

渲染背景图片,使背景图片不失真
public static RendererBackground ( Graphics g, Rectangle rect, Image backgroundImage, bool method ) : void
g System.Drawing.Graphics
rect System.Drawing.Rectangle
backgroundImage Image
method bool
return void
Example #1
0
 /// <summary>
 /// 渲染背景图片,使背景图片不失真
 /// </summary>
 /// <param name="g"></param>
 /// <param name="rect"></param>
 /// <param name="backgroundImage"></param>
 /// <param name="method"></param>
 public static void RendererBackground(Graphics g, Rectangle rect, Image backgroundImage, bool method)
 {
     if (!method)
     {
         g.DrawImage(backgroundImage, new Rectangle(rect.X + 0, rect.Y, 5, rect.Height), 0, 0, 5, backgroundImage.Height, GraphicsUnit.Pixel);
         g.DrawImage(backgroundImage, new Rectangle(rect.X + 5, rect.Y, rect.Width - 10, rect.Height), 5, 0, backgroundImage.Width - 10, backgroundImage.Height, GraphicsUnit.Pixel);
         g.DrawImage(backgroundImage, new Rectangle(rect.X + rect.Width - 5, rect.Y, 5, rect.Height), backgroundImage.Width - 5, 0, 5, backgroundImage.Height, GraphicsUnit.Pixel);
     }
     else
     {
         DrawHelper.RendererBackground(g, rect, 5, backgroundImage);
     }
 }