forked from jaysonragasa/MultiRDPClient.NET
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathComboBox.cs
More file actions
40 lines (39 loc) · 900 Bytes
/
ComboBox.cs
File metadata and controls
40 lines (39 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace CommonTools
{
public class FloatComboBox : NameObjectComboBox<float>
{
}
public class NameObjectComboBox<T> : System.Windows.Forms.ComboBox
{
CommonTools.NameObjectCollection<T> m_items = new CommonTools.NameObjectCollection<T>();
public new CommonTools.NameObjectCollection<T> Items
{
get { return m_items; }
set
{
m_items = value;
DataSource = m_items;
}
}
public new CommonTools.NameObject<T> SelectedItem
{
get { return base.SelectedItem as CommonTools.NameObject<T>; }
set { base.SelectedItem = value; }
}
public NameObjectComboBox()
{
DisplayMember = "Name";
ValueMember = "Object";
}
protected override void OnLeave(EventArgs e)
{
if (DataBindings.Count > 0)
DataBindings[0].WriteValue();
base.OnLeave(e);
}
}
}