C# graphics.drawimage 绘制的图形,能否放置在控件之上?
都不是我想要的,我想做pictureBox拖动的影子,如果用PicBox来拖动的话,刷新太慢了,根本跟不上!!,所以才不考虑用控件来支撑的,看来这条路是走不通了,用控件拖动跟不上@@ 展开
你可以分两步绘制先在From绘制,再在控件上绘制,如下
凹下去的部分是一个PictureBox,为了明显我加上了边框,用的时候去掉就行了
private void button1_Click(object sender, EventArgs e)
{
Graphics g = this.CreateGraphics();
Bitmap source = (Bitmap)Bitmap.FromFile("D:\\A001.jpg");
g.DrawImage(source, new Point(0, 0));
g.Dispose();
g = pictureBox1.CreateGraphics();
Bitmap bit = source.Clone(new Rectangle(pictureBox1.Location, pictureBox1.Size),
System.Drawing.Imaging.PixelFormat.Format32bppArgb);
g.DrawImage(bit, new Point(0, 0));
source.Dispose();
bit.Dispose();
g.Dispose();
}