protected override void OnPaint(PaintEventArgs e)
{
    DrawBorder(e.Graphics);
}DrawBorder(Graphics g)
{
//这里画出来的图片是灰色的,为什么?如何解决?
    g.DrawImage(Properties.Resources.Window, DestLU, SourceLU, GraphicsUnit.Pixel);}

解决方案 »

  1.   

     e.Graphics.DrawImage(cp.Image, new Rectangle(topPagesLocationX, topPagesLocationY, cp.Width + 22, cp.Height), 
                                        0, 0, cp.Image.Width,
                                        cp.Image.Height,
                                        GraphicsUnit.Pixel
                                       );
    我是这样画的图片,画出来没问题,可供参考!你把[Color]这个标签去掉试试,为什么要加那个标签呢?
      

  2.   

    ........[Color]是想把那句在这里边变成红色....为什么会灰色我已经找到原因....虽然我用transpatkey(是这个写吧..)隐藏了窗体,但Graphics画图时还是产生了颜色的叠加(图片为半透明的)
      

  3.   


    Rectangle image_rect = new Rectangle(0, 0, 
        Properties.Resources.TestImage.Width, Properties.Resources.TestImage.Height);
    e.Graphics.DrawImage(Properties.Resources.TestImage, ClientRectangle, image_rect, GraphicsUnit.Pixel);
    SolidBrush alpha_brush = new SolidBrush(Color.FromArgb(128, 128, 128, 128));
    e.Graphics.FillRectangle(alpha_brush, ClientRectangle);
    alpha_brush.Dispose();