2011-02-11 112 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(); 
      } 
     } 
    }