* UIComboBox: 修复在窗体构造函数设置SelectedIndex报错
* UIDropControl: 修改按钮大小调整时,清除按钮的位置
This commit is contained in:
parent
882dbb3f40
commit
63c5788254
@ -32,6 +32,7 @@
|
|||||||
* 2023-10-26: V3.5.1 字体图标增加旋转角度参数SymbolRotate
|
* 2023-10-26: V3.5.1 字体图标增加旋转角度参数SymbolRotate
|
||||||
* 2023-12-18: V3.6.2 修复高度不随字体改变
|
* 2023-12-18: V3.6.2 修复高度不随字体改变
|
||||||
* 2024-01-19: V3.6.3 下拉按钮可修改大小及位置
|
* 2024-01-19: V3.6.3 下拉按钮可修改大小及位置
|
||||||
|
* 2024-01-27: V3.6.3 修改按钮大小调整时,清除按钮的位置
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -75,8 +76,6 @@ namespace Sunny.UI
|
|||||||
fillColor = Color.White;
|
fillColor = Color.White;
|
||||||
edit.BackColor = Color.White;
|
edit.BackColor = Color.White;
|
||||||
MouseMove += UIDropControl_MouseMove;
|
MouseMove += UIDropControl_MouseMove;
|
||||||
|
|
||||||
ControlBoxRect = new Rectangle(Width - 24, 0, 24, Height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int lastEditHeight = -1;
|
int lastEditHeight = -1;
|
||||||
@ -426,7 +425,6 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
edit.Left = 4 + Padding.Left;
|
edit.Left = 4 + Padding.Left;
|
||||||
edit.Width = Width - Padding.Left - Padding.Right - 4;
|
edit.Width = Width - Padding.Left - Padding.Right - 4;
|
||||||
ControlBoxRect = new Rectangle(Width - 24, 0, 24, Height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -481,7 +479,7 @@ namespace Sunny.UI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool inControlBox = e.Location.InRect(ControlBoxRect);
|
bool inControlBox = e.Location.X > Width - Padding.Right;
|
||||||
if (inControlBox != NeedDrawClearButton && Text.IsValid())
|
if (inControlBox != NeedDrawClearButton && Text.IsValid())
|
||||||
{
|
{
|
||||||
NeedDrawClearButton = inControlBox;
|
NeedDrawClearButton = inControlBox;
|
||||||
@ -499,7 +497,6 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle ControlBoxRect;
|
|
||||||
protected bool showClearButton;
|
protected bool showClearButton;
|
||||||
|
|
||||||
protected override void OnGotFocus(EventArgs e)
|
protected override void OnGotFocus(EventArgs e)
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
* 2023-07-03: V3.3.9 修改了几个对象的释放
|
* 2023-07-03: V3.3.9 修改了几个对象的释放
|
||||||
* 2023-08-11: V3.4.1 Items.Clear后,DropDownStyle为DropDown时,不清空Text
|
* 2023-08-11: V3.4.1 Items.Clear后,DropDownStyle为DropDown时,不清空Text
|
||||||
* 2023-12-26: V3.6.2 增加下拉界面的滚动条设置
|
* 2023-12-26: V3.6.2 增加下拉界面的滚动条设置
|
||||||
|
* 2024-01-27: V3.6.3 修复在窗体构造函数设置SelectedIndex报错
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
@ -616,9 +616,21 @@ namespace Sunny.UI
|
|||||||
public int SelectedIndex
|
public int SelectedIndex
|
||||||
{
|
{
|
||||||
get => listbox.SelectedIndex;
|
get => listbox.SelectedIndex;
|
||||||
set => listbox.SelectedIndex = value;
|
set
|
||||||
|
{
|
||||||
|
if (value >= 0)
|
||||||
|
{
|
||||||
|
if (listbox != null && listbox.Items != null && listbox.Items.ContainsIndex(value))
|
||||||
|
listbox.SelectedIndex = value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
listbox.SelectedIndex = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[Browsable(false)]
|
[Browsable(false)]
|
||||||
[DefaultValue(null)]
|
[DefaultValue(null)]
|
||||||
public object SelectedItem
|
public object SelectedItem
|
||||||
|
Loading…
x
Reference in New Issue
Block a user