【发布时间】:2014-01-24 10:52:45
【问题描述】:
我有一个没有边框和标题栏的自定义表单。我正在使用面板(宽度 = 1px)来模拟边框。一切都很好,除了左边框和上边框。当我尝试减小表单的大小(通过将其拖动到右侧)时,它可以正常工作,但是当表单的大小 == this.MinimumSize 时。它开始向右侧移动。我只想改变大小,而不是移动...... 这是我的leftBorder代码。我如何修改它以仅更改大小?
private void borderW_MouseDown(object sender, MouseEventArgs e)
{
Active = true;
}
private void borderW_MouseMove(object sender, MouseEventArgs e)
{
if (Active)
{
if (e.X < 0)
{
this.Location = new Point(this.Left + e.X, this.Top);
this.Size = new Size(this.Width - e.X, this.Height);
}
else
{
this.Size = new Size(this.Width - e.X, this.Height);
this.Location = new Point(this.Left + e.X, this.Top);
}
}
}
private void borderW_MouseUp(object sender, MouseEventArgs e)
{
Active = false;
}
【问题讨论】: