【发布时间】:2019-04-30 12:31:35
【问题描述】:
我正在使用以下方法为带有 FixedSingle FormBorderStyle 的表单重新创建大小调整功能来更新大小/位置:
private void resizeBottom()
{
this.SuspendLayout();
this.SetBoundsCore(this.Location.X, this.Location.Y, this.Width, Cursor.Position.Y - this.Location.Y, BoundsSpecified.Size);
}
…(other resize helpers)...
protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
{
base.SetBoundsCore(x, y, width, height, specified);
this.ResumeLayout();
}
但是,当我尝试调整窗口大小时,我得到了很多伪像,特别是如果我以正确的速度调整大小,窗口看起来就像在屏幕上被“涂抹”了一样。我尝试过启用双缓冲,但似乎没有什么不同。
【问题讨论】:
-
你在哪里打电话
resizeBottom?它是调用一次还是作为动画调用?另见:stackoverflow.com/a/8776905/880990 -
我在 MouseMoved 事件处理程序中调用它。
标签: winforms optimization resize