为什么使用此代码段不会在屏幕上绘制图像?在此行之前还有其他命令可以正常工作。例如,有一些矩形和填充形状命令可以工作。
Graphics imgGB = e.Graphics;
imgGB.DrawImage(
Properties.Resources.logo,
new Rectangle(
new Point(DoorGlassFill.Left, DoorPrimeter.Bottom + Drawing_HandleHeight),
new Size(200,200)));
整个方法是:
//draw door
Graphics DoorGP = e.Graphics;
Rectangle DoorFrame = new Rectangle(new Point(DoorPrimeter.Left + Drawing_LeftDis + Drawing_Off, DoorPrimeter.Top + TopDistance + (2*Drawing_Off)+Drawing_TopBlockHeight), new Size(Drawing_DoorWidth,DoorPrimeter.Height-TopDistance-Drawing_TopBlockHeight-(2*Drawing_Off)));
DoorGP.DrawRectangle(pen, DoorFrame);
Rectangle GP113 = new Rectangle(new Point(DoorFrame.Left+Drawing_GP113,DoorFrame.Top+Drawing_GP113), new Size(DoorFrame.Width-(2*Drawing_GP113),DoorFrame.Height-Drawing_GP113));
DoorGP.DrawRectangle(pen, GP113);
Rectangle DoorGlass = new Rectangle(new Point(GP113.Left+Drawing_GP119,GP113.Top+Drawing_GP119), new Size(GP113.Width-(2*Drawing_GP119),GP113.Height-Drawing_GP119));
Graphics GlassFillGP = e.Graphics;
Rectangle DoorGlassFill = new Rectangle(new Point(GP113.Left + Drawing_GP119, GP113.Top + Drawing_GP119), new Size(GP113.Width - (2 * Drawing_GP119), GP113.Height - (2 * Drawing_GP119)));
GlassFillGP.FillRectangle(new LinearGradientBrush(DoorGlassFill, Color.AliceBlue, Color.LightSkyBlue, 45f), DoorGlassFill);
DoorGP.DrawRectangle(pen, DoorGlass);
Graphics imgGB = e.Graphics;
imgGB.DrawImage(Properties.Resources.logo__sajiran1,new Rectangle(new Point(DoorGlassFill.Left, DoorPrimeter.Bottom + Drawing_HandleHeight),new Size(200,200)));
也尝试了这个:
//draw door
Graphics DoorGP = e.Graphics;
Rectangle DoorFrame = new Rectangle(new Point(DoorPrimeter.Left + Drawing_LeftDis + Drawing_Off, DoorPrimeter.Top + TopDistance + (2*Drawing_Off)+Drawing_TopBlockHeight), new Size(Drawing_DoorWidth,DoorPrimeter.Height-TopDistance-Drawing_TopBlockHeight-(2*Drawing_Off)));
DoorGP.DrawRectangle(pen, DoorFrame);
Rectangle GP113 = new Rectangle(new Point(DoorFrame.Left+Drawing_GP113,DoorFrame.Top+Drawing_GP113), new Size(DoorFrame.Width-(2*Drawing_GP113),DoorFrame.Height-Drawing_GP113));
DoorGP.DrawRectangle(pen, GP113);
Rectangle DoorGlass = new Rectangle(new Point(GP113.Left+Drawing_GP119,GP113.Top+Drawing_GP119), new Size(GP113.Width-(2*Drawing_GP119),GP113.Height-Drawing_GP119));
Graphics GlassFillGP = e.Graphics;
Rectangle DoorGlassFill = new Rectangle(new Point(GP113.Left + Drawing_GP119, GP113.Top + Drawing_GP119), new Size(GP113.Width - (2 * Drawing_GP119), GP113.Height - (2 * Drawing_GP119)));
GlassFillGP.FillRectangle(new LinearGradientBrush(DoorGlassFill, Color.AliceBlue, Color.LightSkyBlue, 45f), DoorGlassFill);
DoorGP.DrawRectangle(pen, DoorGlass);
Bitmap img = Properties.Resources.Handle_Meroni;
Graphics imgGB = e.Graphics;
img.SetResolution(imgGB.DpiX, imgGB.DpiY);
imgGB.DrawImage(img,new Rectangle(new Point(DoorGlassFill.Left, DoorPrimeter.Bottom + Drawing_HandleHeight),new Size(200,200)));