本文介绍了画上picturebox1的油漆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,我想当我点击button1在picturebox1的油漆上画一个椭圆。
hello, i want when i click on button1 draw a ellipse on paint of picturebox1.
推荐答案
private bool drawIt = false;
private void myButton_Click(object sender, EventArgs e)
{
drawIt = !drawIt;
myPictureBox.Invalidate();
}
private void myPictureBox_Paint(object sender, PaintEventArgs e)
{
if (drawIt)
{
e.Graphics.DrawEllipse(Pens.Red, 10, 10, myPictureBox.Width - 20, myPictureBox.Height - 20);
}
}
这篇关于画上picturebox1的油漆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!