* UIForm: 增加Movable属性,控制点击标题行是否能移动窗体

This commit is contained in:
Sunny 2021-09-12 13:12:28 +08:00
parent 95db230a7e
commit ca71592dc4
3 changed files with 5 additions and 1 deletions

Binary file not shown.

Binary file not shown.

View File

@ -70,6 +70,10 @@ namespace Sunny.UI
showTitleIcon = false; showTitleIcon = false;
} }
[DefaultValue(true)]
[Description("是否点击标题栏可以移动窗体"), Category("SunnyUI")]
public bool Movable { get; set; } = true;
public void Translate() public void Translate()
{ {
List<Control> controls = this.GetTranslateControls("ITranslate"); List<Control> controls = this.GetTranslateControls("ITranslate");
@ -648,7 +652,7 @@ namespace Sunny.UI
if (!ShowTitle) return; if (!ShowTitle) return;
if (e.Y > Padding.Top) return; if (e.Y > Padding.Top) return;
if (e.Button == MouseButtons.Left) if (e.Button == MouseButtons.Left && Movable)
{ {
FormMoveMouseDown = true; FormMoveMouseDown = true;
FormLocation = Location; FormLocation = Location;