+ UIComboBox:增加DataSource
This commit is contained in:
parent
81f8c709b3
commit
3df0e10b65
BIN
Bin/SunnyUI.dll
BIN
Bin/SunnyUI.dll
Binary file not shown.
BIN
Bin/SunnyUI.pdb
BIN
Bin/SunnyUI.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
2
SunnyUI.Demo/Controls/FCombobox.Designer.cs
generated
2
SunnyUI.Demo/Controls/FCombobox.Designer.cs
generated
@ -182,6 +182,7 @@
|
|||||||
// uiComboBox2
|
// uiComboBox2
|
||||||
//
|
//
|
||||||
this.uiComboBox2.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList;
|
this.uiComboBox2.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList;
|
||||||
|
this.uiComboBox2.DropDownWidth = 0;
|
||||||
this.uiComboBox2.FillColor = System.Drawing.Color.White;
|
this.uiComboBox2.FillColor = System.Drawing.Color.White;
|
||||||
this.uiComboBox2.Font = new System.Drawing.Font("微软雅黑", 12F);
|
this.uiComboBox2.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||||
this.uiComboBox2.Items.AddRange(new object[] {
|
this.uiComboBox2.Items.AddRange(new object[] {
|
||||||
@ -202,6 +203,7 @@
|
|||||||
//
|
//
|
||||||
// uiComboBox1
|
// uiComboBox1
|
||||||
//
|
//
|
||||||
|
this.uiComboBox1.DropDownWidth = 0;
|
||||||
this.uiComboBox1.FillColor = System.Drawing.Color.White;
|
this.uiComboBox1.FillColor = System.Drawing.Color.White;
|
||||||
this.uiComboBox1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
this.uiComboBox1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||||
this.uiComboBox1.Items.AddRange(new object[] {
|
this.uiComboBox1.Items.AddRange(new object[] {
|
||||||
|
@ -104,6 +104,9 @@ namespace Sunny.UI
|
|||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||||
|
public bool DroppedDown=> itemForm != null && itemForm.Visible;
|
||||||
|
|
||||||
private int symbolNormal = 61703;
|
private int symbolNormal = 61703;
|
||||||
private int dropSymbol = 61703;
|
private int dropSymbol = 61703;
|
||||||
|
|
||||||
@ -267,6 +270,20 @@ namespace Sunny.UI
|
|||||||
set => edit.MaxLength = Math.Max(value, 1);
|
set => edit.MaxLength = Math.Max(value, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Browsable(false),DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||||
|
public int SelectionLength
|
||||||
|
{
|
||||||
|
get => edit.SelectionLength;
|
||||||
|
set => edit.SelectionLength = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
[ Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden) ]
|
||||||
|
public int SelectionStart
|
||||||
|
{
|
||||||
|
get => edit.SelectionStart;
|
||||||
|
set => edit.SelectionStart = value;
|
||||||
|
}
|
||||||
|
|
||||||
public override void SetStyleColor(UIBaseStyle uiColor)
|
public override void SetStyleColor(UIBaseStyle uiColor)
|
||||||
{
|
{
|
||||||
base.SetStyleColor(uiColor);
|
base.SetStyleColor(uiColor);
|
||||||
@ -302,7 +319,21 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
ButtonClick?.Invoke(this, e);
|
ButtonClick?.Invoke(this, e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//public event EventHandler DropDown;
|
||||||
|
|
||||||
|
//public event EventHandler DropDownClosed;
|
||||||
|
|
||||||
|
public void Select(int start, int length)
|
||||||
|
{
|
||||||
|
edit.Select(start, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SelectAll()
|
||||||
|
{
|
||||||
|
edit.SelectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TextBoxEx : TextBox
|
private class TextBoxEx : TextBox
|
||||||
|
@ -1,4 +1,25 @@
|
|||||||
using System;
|
/******************************************************************************
|
||||||
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
|
* CopyRight (C) 2012-2020 ShenYongHua(沈永华).
|
||||||
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@qq.com
|
||||||
|
*
|
||||||
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
* Gitee: https://gitee.com/yhuse/SunnyUI
|
||||||
|
* GitHub: https://github.com/yhuse/SunnyUI
|
||||||
|
*
|
||||||
|
* SunnyUI.dll can be used for free under the GPL-3.0 license.
|
||||||
|
* If you use this code, please keep this note.
|
||||||
|
* 如果您使用此代码,请保留此说明。
|
||||||
|
******************************************************************************
|
||||||
|
* 文件名称: UIBattery.cs
|
||||||
|
* 文件说明: 电池电量图标
|
||||||
|
* 当前版本: V2.2
|
||||||
|
* 创建日期: 2020-06-04
|
||||||
|
*
|
||||||
|
* 2020-06-04: V2.2.5 增加文件
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
* 创建日期: 2020-01-01
|
* 创建日期: 2020-01-01
|
||||||
*
|
*
|
||||||
* 2020-01-01: V2.2.0 增加文件说明
|
* 2020-01-01: V2.2.0 增加文件说明
|
||||||
|
* 2020-06-11: V2.2.5 增加DataSource
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -24,28 +25,121 @@ using System.ComponentModel;
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Design;
|
using System.Drawing.Design;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using static System.Windows.Forms.ComboBox;
|
||||||
|
|
||||||
namespace Sunny.UI
|
namespace Sunny.UI
|
||||||
{
|
{
|
||||||
[DefaultProperty("Items")]
|
[DefaultProperty("Items")]
|
||||||
[DefaultEvent("SelectedIndexChanged")]
|
[DefaultEvent("SelectedIndexChanged")]
|
||||||
[ToolboxItem(true)]
|
[ToolboxItem(true)]
|
||||||
|
[LookupBindingProperties("DataSource", "DisplayMember", "ValueMember", "SelectedValue")]
|
||||||
public sealed partial class UIComboBox : UIDropControl
|
public sealed partial class UIComboBox : UIDropControl
|
||||||
{
|
{
|
||||||
public UIComboBox()
|
public UIComboBox()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
box.SelectedIndexChanged += Box_SelectedIndexChanged;
|
||||||
|
box.SelectionChangeCommitted += Box_SelectionChangeCommitted;
|
||||||
|
box.TextUpdate += Box_TextUpdate;
|
||||||
|
box.DataSourceChanged += Box_DataSourceChanged;
|
||||||
|
box.DisplayMemberChanged += Box_DisplayMemberChanged;
|
||||||
|
box.Format += Box_Format;
|
||||||
|
box.FormatInfoChanged += Box_FormatInfoChanged;
|
||||||
|
box.FormatStringChanged += Box_FormatStringChanged;
|
||||||
|
box.FormattingEnabledChanged += Box_FormattingEnabledChanged;
|
||||||
|
box.ValueMemberChanged += Box_ValueMemberChanged;
|
||||||
|
box.SelectedValueChanged += Box_SelectedValueChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Box_SelectedValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SelectedValueChanged?.Invoke(sender, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Box_ValueMemberChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ValueMemberChanged?.Invoke(sender, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Box_FormattingEnabledChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
FormattingEnabledChanged?.Invoke(sender, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Box_FormatStringChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
FormatStringChanged?.Invoke(sender, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Box_FormatInfoChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
FormatInfoChanged?.Invoke(sender, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Box_Format(object sender, ListControlConvertEventArgs e)
|
||||||
|
{
|
||||||
|
Format?.Invoke(sender, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Box_DisplayMemberChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DisplayMemberChanged?.Invoke(sender, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Box_DataSourceChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DataSourceChanged?.Invoke(sender, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Box_TextUpdate(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
TextUpdate?.Invoke(sender, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Box_SelectionChangeCommitted(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SelectionChangeCommitted?.Invoke(sender, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Box_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SelectedIndexChanged?.Invoke(sender, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler TextUpdate;
|
||||||
|
|
||||||
public event EventHandler SelectedIndexChanged;
|
public event EventHandler SelectedIndexChanged;
|
||||||
|
|
||||||
|
public event EventHandler SelectionChangeCommitted;
|
||||||
|
|
||||||
|
public event EventHandler DataSourceChanged;
|
||||||
|
|
||||||
|
public event EventHandler DisplayMemberChanged;
|
||||||
|
|
||||||
|
public event ListControlConvertEventHandler Format;
|
||||||
|
|
||||||
|
public event EventHandler FormatStringChanged;
|
||||||
|
|
||||||
|
public event EventHandler FormattingEnabledChanged;
|
||||||
|
|
||||||
|
public event EventHandler ValueMemberChanged;
|
||||||
|
|
||||||
|
public event EventHandler SelectedValueChanged;
|
||||||
|
|
||||||
|
[Browsable(false), EditorBrowsable(EditorBrowsableState.Advanced)]
|
||||||
|
public event EventHandler FormatInfoChanged;
|
||||||
|
|
||||||
|
private readonly ComboBox box = new ComboBox();
|
||||||
|
|
||||||
protected override void ItemForm_ValueChanged(object sender, object value)
|
protected override void ItemForm_ValueChanged(object sender, object value)
|
||||||
{
|
{
|
||||||
selectedItem = ListBox.SelectedItem;
|
//selectedItem = ListBox.SelectedItem;
|
||||||
selectedIndex = ListBox.SelectedIndex;
|
//selectedIndex = ListBox.SelectedIndex;
|
||||||
|
box.SelectedIndex = ListBox.SelectedIndex;
|
||||||
Text = ListBox.Text;
|
Text = ListBox.Text;
|
||||||
Invalidate();
|
Invalidate();
|
||||||
SelectedIndexChanged?.Invoke(this, null);
|
//SelectedIndexChanged?.Invoke(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly UIComboBoxItem item = new UIComboBoxItem();
|
private readonly UIComboBoxItem item = new UIComboBoxItem();
|
||||||
@ -66,12 +160,6 @@ namespace Sunny.UI
|
|||||||
get => item.ListBox;
|
get => item.ListBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
|
||||||
[Localizable(true)]
|
|
||||||
[Editor("System.Windows.Forms.Design.ListControlStringCollectionEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
|
|
||||||
[MergableProperty(false)]
|
|
||||||
public ListBox.ObjectCollection Items => ListBox?.Items;
|
|
||||||
|
|
||||||
[DefaultValue(25)]
|
[DefaultValue(25)]
|
||||||
public int ItemHeight
|
public int ItemHeight
|
||||||
{
|
{
|
||||||
@ -82,43 +170,17 @@ namespace Sunny.UI
|
|||||||
[DefaultValue(8)]
|
[DefaultValue(8)]
|
||||||
public int MaxDropDownItems { get; set; } = 8;
|
public int MaxDropDownItems { get; set; } = 8;
|
||||||
|
|
||||||
private int selectedIndex = -1;
|
//[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||||
|
//[Localizable(true)]
|
||||||
|
//[Editor("System.Windows.Forms.Design.ListControlStringCollectionEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
|
||||||
|
//[MergableProperty(false)]
|
||||||
|
//public ListBox.ObjectCollection Items => ListBox?.Items;
|
||||||
|
|
||||||
[Browsable(false)]
|
private void UIComboBox_FontChanged(object sender, EventArgs e)
|
||||||
[DefaultValue(-1)]
|
|
||||||
public int SelectedIndex
|
|
||||||
{
|
{
|
||||||
get => selectedIndex;
|
if (ItemForm != null)
|
||||||
set
|
|
||||||
{
|
{
|
||||||
if (value.InRange(-1, ListBox.Items.Count - 1))
|
ListBox.Font = Font;
|
||||||
{
|
|
||||||
ListBox.SelectedIndex = value;
|
|
||||||
selectedIndex = value;
|
|
||||||
|
|
||||||
if (value >= 0)
|
|
||||||
{
|
|
||||||
Text = ListBox.Items[value].ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private object selectedItem;
|
|
||||||
|
|
||||||
[Browsable(false)]
|
|
||||||
[DefaultValue(null)]
|
|
||||||
public object SelectedItem
|
|
||||||
{
|
|
||||||
get => selectedItem;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value != null)
|
|
||||||
{
|
|
||||||
int idx = ListBox.Items.IndexOf(value);
|
|
||||||
SelectedIndex = idx;
|
|
||||||
selectedItem = idx >= 0 ? value : null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,15 +191,15 @@ namespace Sunny.UI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemForm.Show(this, new Size(Width, CalcItemFormHeight()));
|
ListBox.Items.Clear();
|
||||||
}
|
|
||||||
|
|
||||||
private void UIComboBox_FontChanged(object sender, EventArgs e)
|
foreach (var item in Items)
|
||||||
{
|
|
||||||
if (ItemForm != null)
|
|
||||||
{
|
{
|
||||||
ListBox.Font = Font;
|
ListBox.Items.Add(GetItemText(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ListBox.SelectedIndex = SelectedIndex;
|
||||||
|
ItemForm.Show(this, new Size(Width, CalcItemFormHeight()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetStyleColor(UIBaseStyle uiColor)
|
public override void SetStyleColor(UIBaseStyle uiColor)
|
||||||
@ -147,5 +209,226 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
ListBox.SetStyleColor(uiColor);
|
ListBox.SetStyleColor(uiColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[
|
||||||
|
DefaultValue(AutoCompleteMode.None),
|
||||||
|
Browsable(true), EditorBrowsable(EditorBrowsableState.Always)
|
||||||
|
]
|
||||||
|
public AutoCompleteMode AutoCompleteMode
|
||||||
|
{
|
||||||
|
get => box.AutoCompleteMode;
|
||||||
|
set => box.AutoCompleteMode = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
[
|
||||||
|
DefaultValue(AutoCompleteSource.None),
|
||||||
|
Browsable(true), EditorBrowsable(EditorBrowsableState.Always)
|
||||||
|
]
|
||||||
|
public AutoCompleteSource AutoCompleteSource
|
||||||
|
{
|
||||||
|
get => box.AutoCompleteSource;
|
||||||
|
set => box.AutoCompleteSource = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Browsable(true)]
|
||||||
|
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||||
|
[Editor("System.Windows.Forms.Design.ListControlStringCollectionEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
|
||||||
|
[EditorBrowsable(EditorBrowsableState.Always)]
|
||||||
|
[Localizable(true)]
|
||||||
|
public AutoCompleteStringCollection AutoCompleteCustomSource
|
||||||
|
{
|
||||||
|
get => box.AutoCompleteCustomSource;
|
||||||
|
set => box.AutoCompleteCustomSource = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DefaultValue(null), RefreshProperties(RefreshProperties.Repaint), AttributeProvider(typeof(IListSource))]
|
||||||
|
public object DataSource
|
||||||
|
{
|
||||||
|
get => box.DataSource;
|
||||||
|
set => box.DataSource = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DefaultValue(DrawMode.Normal), RefreshProperties(RefreshProperties.Repaint)]
|
||||||
|
public DrawMode DrawMode
|
||||||
|
{
|
||||||
|
get => box.DrawMode;
|
||||||
|
set => box.DrawMode = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int DropDownWidth { get; set; }
|
||||||
|
|
||||||
|
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||||
|
[Editor("System.Windows.Forms.Design.ListControlStringCollectionEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
|
||||||
|
[Localizable(true)]
|
||||||
|
[MergableProperty(false)]
|
||||||
|
public ObjectCollection Items
|
||||||
|
{
|
||||||
|
get => box.Items;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||||
|
public int SelectedIndex
|
||||||
|
{
|
||||||
|
get => box.SelectedIndex;
|
||||||
|
set => box.SelectedIndex = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Browsable(false), Bindable(true), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||||
|
public object SelectedItem
|
||||||
|
{
|
||||||
|
get => box.SelectedItem;
|
||||||
|
set => box.SelectedItem = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||||
|
public string SelectedText
|
||||||
|
{
|
||||||
|
get => box.SelectedText;
|
||||||
|
set => box.SelectedText = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DefaultValue(false)]
|
||||||
|
public bool Sorted
|
||||||
|
{
|
||||||
|
get => box.Sorted;
|
||||||
|
set => box.Sorted = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void BeginUpdate()
|
||||||
|
{
|
||||||
|
box.BeginUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EndUpdate()
|
||||||
|
{
|
||||||
|
box.EndUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int FindString(string s)
|
||||||
|
{
|
||||||
|
return box.FindString(s, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int FindString(string s, int startIndex)
|
||||||
|
{
|
||||||
|
return box.FindString(s, startIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int FindStringExact(string s)
|
||||||
|
{
|
||||||
|
return box.FindStringExact(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int FindStringExact(string s, int startIndex)
|
||||||
|
{
|
||||||
|
return box.FindStringExact(s, startIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ResetText()
|
||||||
|
{
|
||||||
|
box.ResetText();
|
||||||
|
}
|
||||||
|
|
||||||
|
[DefaultValue("")]
|
||||||
|
[Editor("System.Windows.Forms.Design.DataMemberFieldEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
|
||||||
|
[TypeConverter("System.Windows.Forms.Design.DataMemberFieldConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
|
||||||
|
public string DisplayMember
|
||||||
|
{
|
||||||
|
get => box.DisplayMember;
|
||||||
|
set => box.DisplayMember = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
[
|
||||||
|
Browsable(false),
|
||||||
|
EditorBrowsable(EditorBrowsableState.Advanced),
|
||||||
|
DefaultValue(null)
|
||||||
|
]
|
||||||
|
public IFormatProvider FormatInfo
|
||||||
|
{
|
||||||
|
get => box.FormatInfo;
|
||||||
|
set => box.FormatInfo = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DefaultValue("")]
|
||||||
|
[Editor("System.Windows.Forms.Design.FormatStringEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
|
||||||
|
[MergableProperty(false)]
|
||||||
|
/// <include file='doc\ListControl.uex' path='docs/doc[@for="ListControl.FormatString"]/*' />
|
||||||
|
public string FormatString
|
||||||
|
{
|
||||||
|
get => box.FormatString;
|
||||||
|
set => box.FormatString = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DefaultValue(false)]
|
||||||
|
public bool FormattingEnabled
|
||||||
|
{
|
||||||
|
get => box.FormattingEnabled;
|
||||||
|
set => box.FormattingEnabled = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DefaultValue("")]
|
||||||
|
[Editor("System.Windows.Forms.Design.DataMemberFieldEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
|
||||||
|
public string ValueMember
|
||||||
|
{
|
||||||
|
get => box.ValueMember;
|
||||||
|
set => box.ValueMember = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
[
|
||||||
|
DefaultValue(null),
|
||||||
|
Browsable(false),
|
||||||
|
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden),
|
||||||
|
Bindable(true)
|
||||||
|
]
|
||||||
|
public object SelectedValue
|
||||||
|
{
|
||||||
|
get => box.SelectedValue;
|
||||||
|
set => box.SelectedValue = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetItemText(object item)
|
||||||
|
{
|
||||||
|
return box.GetItemText(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
//private int selectedIndex = -1;
|
||||||
|
|
||||||
|
//[Browsable(false)]
|
||||||
|
//[DefaultValue(-1)]
|
||||||
|
//public int SelectedIndex
|
||||||
|
//{
|
||||||
|
// get => selectedIndex;
|
||||||
|
// set
|
||||||
|
// {
|
||||||
|
// if (value.InRange(-1, ListBox.Items.Count - 1))
|
||||||
|
// {
|
||||||
|
// ListBox.SelectedIndex = value;
|
||||||
|
// selectedIndex = value;
|
||||||
|
|
||||||
|
// if (value >= 0)
|
||||||
|
// {
|
||||||
|
// Text = ListBox.Items[value].ToString();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
//private object selectedItem;
|
||||||
|
|
||||||
|
//[Browsable(false)]
|
||||||
|
//[DefaultValue(null)]
|
||||||
|
//public object SelectedItem
|
||||||
|
//{
|
||||||
|
// get => selectedItem;
|
||||||
|
// set
|
||||||
|
// {
|
||||||
|
// if (value != null)
|
||||||
|
// {
|
||||||
|
// int idx = ListBox.Items.IndexOf(value);
|
||||||
|
// SelectedIndex = idx;
|
||||||
|
// selectedItem = idx >= 0 ? value : null;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,6 +4,7 @@
|
|||||||
+ 增加到Nuget
|
+ 增加到Nuget
|
||||||
* UIFrame:修复框架页面放置UIContextMenuStrip时显示错位
|
* UIFrame:修复框架页面放置UIContextMenuStrip时显示错位
|
||||||
* UIAvatar:修复Dock为Right时刷新问题
|
* UIAvatar:修复Dock为Right时刷新问题
|
||||||
|
+ UIComboBox:增加DataSource
|
||||||
|
|
||||||
2020.06.10
|
2020.06.10
|
||||||
+ UINaveMenu:增加ShowOneNode,同一层只显示一个打开的节点
|
+ UINaveMenu:增加ShowOneNode,同一层只显示一个打开的节点
|
||||||
|
Loading…
x
Reference in New Issue
Block a user