使控件整个图象失效,并重新绘制控件
_mChart.Invalidate();
将控件的背景色和窗体的背景色保持一致
private void UserControl1_Paint(object sender, PaintEventArgs e) { e.Graphics.Clear(this.BackColor); }
使用图片作为画布
Bitmap bmp = new Bitmap(600, 400, System.Drawing.Imaging.PixelFormat.Format32bppArgb); Graphics g = Graphics.FromImage(bmp);
系统默认提供的宽度为1的Pen对象
Pen redPen = new Pen(Color.Red, 2); Pen blackPen = Pens.Black;//系统默认宽度为1的Pen实例
标签:控件,常用,代码,bmp,new,Bitmap,Pen,Graphics,GDI From: https://www.cnblogs.com/friend/p/18012384