大小调整与重绘-boost电路计算模版——mathcad

时间:2021-06-09 23:59:49
【文件属性】:
文件名称:大小调整与重绘-boost电路计算模版——mathcad
文件大小:5.1MB
文件格式:PDF
更新时间:2021-06-09 23:59:49
控件,.NET 53 第三章 GDI+基础 size = i; //重绘 100次 Refresh(); } } protected override void OnPaint(PaintEventArgs e) { Pen pen = new Pen(Color.Red, 3); Rectangle rect = new Rectangle(80, 80, size, size); e.Graphics.DrawRectangle(pen, rect); pen.Dispose(); base.OnPaint(e); System.Threading.Thread.Sleep(20); } 用 Refresh()方法强制刷新 UI即可实现。另外等价的一种写法是: Invalidate(true); Update(); 3.5 大小调整与重绘 前面提到,窗体被遮挡一部分的时候,只会重绘被遮挡的那部分控件,这种设计在某些 情况下确实能提高性能,但是在某些情况下(特别是窗体大小调整的时候)往往这种设计会 出现奇怪的问题。为了更加直观的说明这个问题,下面看一个例子。 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace GDIDemo { public partial class Form3 : Form { public Form3() { InitializeComponent(); } protected override void OnPaint(PaintEventArgs e) {

网友评论