1
我有UserControl:Panel。當我添加到窗體自己的UserControl。 UserControl.Anchor = Left | Right | Top | Bottom。當我調整窗體矩形閃爍時。你怎麼能讓它不眨眼?C#重繪閃爍
public partial class UserControl1 : Panel
{
public UserControl1()
{
InitializeComponent();
this.ResizeRedraw = true;
}
private void UserControl1_Paint(object sender, PaintEventArgs e)
{
using (Graphics g = this.CreateGraphics())
{
Pen pen = new Pen(Color.Black, 1);
Brush brush = new SolidBrush(Color.Black);
g.DrawRectangle(pen, 0, 0, this.Width - 1, this.Height - 1);
pen.Dispose();
}
}
}