!23 调整usebuttonclick属性至基类

Merge pull request !23 from 淘气小浩/master
This commit is contained in:
Sunny 2020-08-27 22:17:58 +08:00 committed by Gitee
commit ccb719b862
6 changed files with 39 additions and 22 deletions

View File

@ -120,6 +120,9 @@
<metadata name="uiToolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="uiToolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>52</value>
</metadata>

View File

@ -77,27 +77,6 @@ namespace Sunny.UI
base.OnClick(e);
}
private bool useDoubleClick = false;
[Description("是否启用双击事件"), Category("SunnyUI")]
[DefaultValue(false)]
public bool UseDoubleClick
{
get
{
return useDoubleClick;
}
set
{
if (useDoubleClick != value)
{
useDoubleClick = value;
SetStyle(ControlStyles.StandardDoubleClick, value);
Invalidate();
}
}
}
private bool showTips = false;
[Description("是否显示角标"), Category("SunnyUI")]

View File

@ -41,6 +41,7 @@ namespace Sunny.UI
Size = new Size(150, 29);
foreColor = UIStyles.Blue.CheckBoxForeColor;
fillColor = UIStyles.Blue.CheckBoxColor;
SetStyle(ControlStyles.StandardDoubleClick, UseDoubleClick);
}
public delegate void OnValueChanged(object sender, bool value);

View File

@ -266,6 +266,27 @@ namespace Sunny.UI
}
}
private bool useDoubleClick = false;
[Description("是否启用双击事件"), Category("SunnyUI")]
[DefaultValue(false)]
public bool UseDoubleClick
{
get
{
return useDoubleClick;
}
set
{
if (useDoubleClick != value)
{
useDoubleClick = value;
//SetStyle(ControlStyles.StandardDoubleClick, useDoubleClick);
//Invalidate();
}
}
}
/// <summary>
/// OnPaint
/// </summary>

View File

@ -398,7 +398,7 @@ namespace Sunny.UI
else if (e.Delta < -10)
{
int nposnum = si.nPos + temp * SystemInformation.MouseWheelScrollLines;
ScrollBarInfo.SetScrollValue(Handle, nposnum <= si.nMax ? nposnum : si.nMax);
ScrollBarInfo.SetScrollValue(Handle, nposnum <= si.ScrollMax ? nposnum : si.ScrollMax);
}
}

View File

@ -143,6 +143,19 @@ namespace Sunny.UI
Active = !Active;
}
protected override void OnDoubleClick(EventArgs e)
{
if (!UseDoubleClick)
{
base.OnClick(e);
Active = !Active;
}
else
{
base.OnDoubleClick(e);
}
}
public override void SetStyleColor(UIBaseStyle uiColor)
{
base.SetStyleColor(uiColor);