我有用户控制:面板。当我添加到表单自己的用户控件时。UserControl.Anchor = 左|右|上|下。当我调整 Form Rectangle 的大小时,它会闪烁。你怎么能让它不眨眼?
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();
}
}
}