2011-02-11 108 views
2

我在面板中创建了一个PictureBox。我在PictureBox上绘制了一些图形。 我想要点击按钮上的图形。我怎样才能做到这一点?如何在c中的图片框上绘制图形#

+0

的可能的复制[如何调用从按钮单击事件油漆事件?(http://stackoverflow.com/questions/27766600/how-to-call-paint-event-from-a-button -Click事件) – 2016-09-27 18:48:12

回答

0

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

尽管代码示例在VB中,您仍会明白。

祝你好运!

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(); 
      } 
     } 
    }