WinForm利用picturebox控件Paint方法绘制图形 实心圆、实心矩形
编程开发
GraphicsWinFormPaintEventArgs
- 首先创建一个WinForm窗体应用
- 拖一个菜单控件(设置几个按钮)和一个picturebox控件(Name属性这里设置为 DrawPanel)
- 后台代码如下
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
this.DrawPanel.Paint += DrawPanel_Paint;
this.SizeChanged += Form2_SizeChanged;
}
private void Form2_SizeChanged(object sender, EventArgs e)
{
this.DrawPanel.Refresh();
}
enum DrawStyle
{