如何在c#中获取图片框上的绘图图形

时间:2011-02-11 10:15:57

标签: c#

我在面板中创建了一个PictureBox。我在PictureBox上画了一些图形。 我想在点击按钮时获取这些图形。我怎么能这样做?

2 个答案:

答案 0 :(得分:0)

检查this链接。特别是 46.9如何以编程方式加载,修改和保存该页面的位图?部分。

即使代码示例是在VB中,你也会明白这个想法。

祝你好运!

答案 1 :(得分:0)

我认为你想要的是你有一些在PictureBox上绘制的图形,你想要点击一个按钮那些图形的图像,不是吗。我不确定这是不是我会工作但是尝试一下;

    private void ButtonGetImage_Click(object sender, EventArgs e)
    {
      if (SourcePictureBox.Image != null)//Just to make sure it's not empty.
       {
         Bitmap graphic = new Bitmap(SourcePictureBox.Image);
          {
            //Add some logic to modify Image if you want.
            graphic.Save(@"F:\Image.bmp");//An appropriate path to save the file.
            graphic.Dispose();
          }
       }
    }
相关问题