C# 在picturebox背景图片上画线并保存下来的图片上背景是黑色没有图片怎么办?
画图并保存代码如下:privatevoidpictureBox1_Paint(objectsender,PaintEventArgse){Imagemyimage=new...
画图并保存代码如下:
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
Image myimage = new Bitmap(pictureBox1.Width, pictureBox1.Height);
Graphics g = Graphics.FromImage(myimage);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
Pen pen1 = new Pen(Color.FromArgb(100, 100, 100), 2);
g.DrawLine(pen1, 100, 100, 400, 400);
pictureBox1.Image = myimage;
myimage.Save("c:\\123.png", System.Drawing.Imaging.ImageFormat.Jpeg);
}
然后在 pictureBox1属性里设了一张背景图片。
如何将背景图片保留在保存下的图片中,求大侠指教! 展开
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
Image myimage = new Bitmap(pictureBox1.Width, pictureBox1.Height);
Graphics g = Graphics.FromImage(myimage);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
Pen pen1 = new Pen(Color.FromArgb(100, 100, 100), 2);
g.DrawLine(pen1, 100, 100, 400, 400);
pictureBox1.Image = myimage;
myimage.Save("c:\\123.png", System.Drawing.Imaging.ImageFormat.Jpeg);
}
然后在 pictureBox1属性里设了一张背景图片。
如何将背景图片保留在保存下的图片中,求大侠指教! 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询