我遇到了問題。有我想用作我的paiting窗口的panel1。而且我也有2個按鈕。應該在面板中間畫「fillRectangle」,第二個應該在旁邊畫「fillellipse」。我沒有繪圖本身的問題C++/CLI Visual C++ 2010 Express - 在一個面板內繪製不同的形狀
Color aColor = Color::FromArgb(255, 0, 0);
SolidBrush^ aBrush = gcnew SolidBrush(aColor);
Rectangle rect = Rectangle(x, y, 10, 10);
e->Graphics->FillEllipse(aBrush, rect);
但我想知道,如何使按下每個按鈕繪製不同的面板內的形狀。我是否需要把兩者在panel1_Paint和使用國旗像橢圓形,長方形......
if(ellip == 1) FillEllipse;
if(recta == 1) FillRectangle
被使用按鈕設置?我希望我可以在按鈕或函數內編寫繪圖部分,然後以某種方式引用該面板。可能嗎?