2020-06-05 21:48:58 +08:00
|
|
|
|
using System;
|
2021-02-08 17:23:26 +08:00
|
|
|
|
using System.Collections.Generic;
|
2021-07-24 17:02:04 +08:00
|
|
|
|
using System.Windows.Forms;
|
2020-06-05 21:48:58 +08:00
|
|
|
|
|
|
|
|
|
namespace Sunny.UI.Demo
|
|
|
|
|
{
|
2021-06-22 09:43:13 +08:00
|
|
|
|
public partial class FCombobox : UIPage
|
2020-06-05 21:48:58 +08:00
|
|
|
|
{
|
|
|
|
|
public FCombobox()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2021-02-08 17:23:26 +08:00
|
|
|
|
|
|
|
|
|
IList<Info> infoList = new List<Info>();
|
2021-08-14 10:02:33 +08:00
|
|
|
|
Info info1 = new Info() { Id = "1", Name = "张三" };
|
|
|
|
|
Info info2 = new Info() { Id = "2", Name = "李四" };
|
|
|
|
|
Info info3 = new Info() { Id = "3", Name = "王五" };
|
2021-02-08 17:23:26 +08:00
|
|
|
|
infoList.Add(info1);
|
|
|
|
|
infoList.Add(info2);
|
|
|
|
|
infoList.Add(info3);
|
|
|
|
|
|
|
|
|
|
uiComboBox2.ValueMember = "Id";
|
|
|
|
|
uiComboBox2.DisplayMember = "Name";
|
2021-02-09 10:23:40 +08:00
|
|
|
|
uiComboBox2.DataSource = infoList;
|
2020-06-23 20:50:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-22 09:43:13 +08:00
|
|
|
|
public class Info
|
2020-06-23 20:50:59 +08:00
|
|
|
|
{
|
2021-06-22 09:43:13 +08:00
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
public string Name { get; set; }
|
2020-06-05 21:48:58 +08:00
|
|
|
|
}
|
2020-10-22 22:20:04 +08:00
|
|
|
|
|
2021-06-22 09:43:13 +08:00
|
|
|
|
private void uiComboBox1_DropDown(object sender, System.EventArgs e)
|
2020-10-22 22:20:04 +08:00
|
|
|
|
{
|
|
|
|
|
uiComboBox1.Items.Clear();
|
|
|
|
|
uiComboBox1.Items.Add("100");
|
|
|
|
|
uiComboBox1.Items.Add("101");
|
|
|
|
|
uiComboBox1.Items.Add("102");
|
|
|
|
|
uiComboBox1.Items.Add("103");
|
|
|
|
|
}
|
2020-11-12 22:49:16 +08:00
|
|
|
|
|
2021-06-22 09:43:13 +08:00
|
|
|
|
private void uiDatePicker1_ValueChanged(object sender, System.DateTime value)
|
2020-11-12 22:49:16 +08:00
|
|
|
|
{
|
2021-06-22 09:43:13 +08:00
|
|
|
|
value.ConsoleWriteLine();
|
2020-11-12 22:49:16 +08:00
|
|
|
|
}
|
2021-02-08 17:23:26 +08:00
|
|
|
|
|
2021-06-22 09:43:13 +08:00
|
|
|
|
private void uiTimePicker1_ValueChanged(object sender, System.DateTime value)
|
2021-02-08 17:23:26 +08:00
|
|
|
|
{
|
2021-06-22 09:43:13 +08:00
|
|
|
|
value.ConsoleWriteLine();
|
2021-02-08 17:23:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-22 09:43:13 +08:00
|
|
|
|
private void uiDatetimePicker1_ValueChanged(object sender, System.DateTime value)
|
2021-02-08 17:23:26 +08:00
|
|
|
|
{
|
2021-06-22 09:43:13 +08:00
|
|
|
|
value.ConsoleWriteLine();
|
2021-02-08 17:23:26 +08:00
|
|
|
|
}
|
2021-03-13 09:53:28 +08:00
|
|
|
|
|
2021-06-22 09:43:13 +08:00
|
|
|
|
private void uiColorPicker1_Click(object sender, System.EventArgs e)
|
2021-03-13 09:53:28 +08:00
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(uiColorPicker1.Value.ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void uiColorPicker1_ValueChanged(object sender, System.Drawing.Color value)
|
|
|
|
|
{
|
2021-06-22 09:43:13 +08:00
|
|
|
|
Console.WriteLine(value.ToString());
|
2021-03-13 09:53:28 +08:00
|
|
|
|
}
|
2021-07-24 17:02:04 +08:00
|
|
|
|
|
|
|
|
|
private void uiComboTreeView2_NodesSelected(object sender, System.Windows.Forms.TreeNodeCollection nodes)
|
|
|
|
|
{
|
|
|
|
|
//返回的nodes为TreeView的所有节点,需循环判断
|
|
|
|
|
foreach (TreeNode item in nodes)
|
|
|
|
|
{
|
|
|
|
|
if (item.Checked)
|
|
|
|
|
Console.WriteLine(item.ToString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void uiComboTreeView3_NodesSelected(object sender, TreeNodeCollection nodes)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2020-06-05 21:48:58 +08:00
|
|
|
|
}
|
|
|
|
|
}
|