当前位置:网站首页>C (thirty) C combobox listview TreeView
C (thirty) C combobox listview TreeView
2022-07-06 03:47:00 【camellias_】
comboBox Drop down list box properties
Items: Drop down list box options
DropDownStyle: Control the appearance and function of the combo box
Simple: Single style
DropDown: Default style ( You can enter )
DropDownList: It looks the same as the default style , But it is not allowed to enter .
ListView List view properties
Activeation:
Standard: Standard events that occur when icons are double clicked consecutively
Oneclick: Events that occur on a single machine
Twoclick: There is no need to double-click continuously , Two single machines
Largeimagelist: Store large icon collections
Smallimagelist: Store a collection of small icons
View: Display style
Tile: tile
List: list
LargeIcon: Large icon
SmallIcon: Small icons
Details: detailed
Columns: Columns displayed in the details view
ListView List view events
ItemActive: Occurs when an item is activated .
columnClick: Occurs when a column header is clicked .
treeView Tree view properties :
nodes: Control
imageindex: Selected image
selectimageindex: The selected picture
SelectNode: Selected node
As shown in the figure below :
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-nORX28aQ-1656122785106)(https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/dadc087da6d34099ad4c4bc62d92406e~tplv-k3u1fbpfcp-zoom-1.image “1555492312851584.png”)]
The test uses all the code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _0416Day
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
int num = comboBox1.SelectedIndex;
if( num == 0)
{
label1.ForeColor = Color.LightPink;
}
else if(num == 1)
{
label1.ForeColor = Color.BlueViolet;
}
else if(num == 2)
{
label1.ForeColor = Color.Blue;
}
else if (num == 3)
{
label1.ForeColor = Color.Coral;
}
}
/**
* Tile button
*/
private void button1_Click(object sender, EventArgs e)
{
listView.View = View.Tile;
}
/**
* List button
*/
private void button2_Click(object sender, EventArgs e)
{
listView.View = View.List;
}
/**
* Large icon button
*/
private void button3_Click(object sender, EventArgs e)
{
listView.View = View.LargeIcon;
}
/**
* Small icon button
*/
private void button4_Click(object sender, EventArgs e)
{
listView.View = View.SmallIcon;
}
/**
* Detailed button
*/
private void button5_Click(object sender, EventArgs e)
{
listView.View = View.Details;
}
private void listView_ItemActivate(object sender, EventArgs e)
{
// Get the corresponding document path
string mydoc = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
string mymusic = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic);
switch(listView.SelectedIndices[0])
{
case 0:System.Diagnostics.Process.Start("calc");break;
case 1: System.Diagnostics.Process.Start(mydoc); break;
case 2: System.Diagnostics.Process.Start("IExplore"); break;
case 3: System.Diagnostics.Process.Start(mymusic); break;
case 4: System.Diagnostics.Process.Start("notepad"); break;
}
}
private void listView_ColumnClick(object sender, ColumnClickEventArgs e)
{
if (listView.Sorting == SortOrder.None)
{
listView.Sorting = SortOrder.Ascending;
}
else if (listView.Sorting == SortOrder.Ascending)
{
listView.Sorting = SortOrder.Descending;
}
else
{
listView.Sorting = SortOrder.Ascending;
}
}
private void treeView_AfterSelect(object sender, TreeViewEventArgs e)
{
// Get the corresponding document path
string mydoc = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
string mymusic = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic);
switch (e.Node.Text)
{
case " Calculator ": System.Diagnostics.Process.Start("calc"); break;
case " My computer ": System.Diagnostics.Process.Start(mydoc); break;
case " my IE": System.Diagnostics.Process.Start("IExplore"); break;
case " My music ": System.Diagnostics.Process.Start(mymusic); break;
case " My notebook ": System.Diagnostics.Process.Start("notepad"); break;
}
}
/**
* Select Add node in the project
*/
private void button7_Click(object sender, EventArgs e)
{
TreeNode cyaa = new TreeNode("cyaa");
cyaa.ImageIndex = 0;
cyaa.SelectedImageIndex = 0;
treeView.SelectedNode.Nodes.Add(cyaa);
}
/**
* Add root and child nodes
*/
private void button6_Click(object sender, EventArgs e)
{
TreeNode cy1 = new TreeNode("cy1");
cy1.ImageIndex = 0;
cy1.SelectedImageIndex = 0;
treeView.Nodes.Add(cy1);
TreeNode cy1a = new TreeNode("cy1a");
cy1a.ImageIndex = 1;
cy1a.SelectedImageIndex = 1;
cy1.Nodes.Add(cy1a);
}
}
}
There are good suggestions , Please enter your comments below .
Welcome to personal blog
https://guanchao.site
Welcome to the applet :

边栏推荐
- Exchange bottles (graph theory + thinking)
- MySQL 中的数据类型介绍
- 给新人工程师组员的建议
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
- 在字节做测试5年,7月无情被辞,想给划水的兄弟提个醒
- Take you to wechat applet development in 3 minutes
- Overview of super-resolution reconstruction of remote sensing images
- No qualifying bean of type ‘......‘ available
- 自动化测试怎么规范部署?
- C#(二十九)之C#listBox checkedlistbox imagelist
猜你喜欢
![[001] [stm32] how to download STM32 original factory data](/img/5a/02d87fe1409a9427180ecefb8326c6.jpg)
[001] [stm32] how to download STM32 original factory data

WPF效果第一百九十一篇之框选ListBox
![Cf464e the classic problem [shortest path, chairman tree]](/img/6b/65b2dc62422a45cc72f287c38dbc58.jpg)
Cf464e the classic problem [shortest path, chairman tree]

Flask learning and project practice 9: WTF form verification

登录mysql输入密码时报错,ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO/YES

Serial port-rs232-rs485-ttl

BUAA magpie nesting

Canvas cut blocks game code

Containerization Foundation

Python implementation of maddpg - (1) openai maddpg environment configuration
随机推荐
Facebook等大廠超十億用戶數據遭泄露,早該關注DID了
Exchange bottles (graph theory + thinking)
关于非虚函数的假派生
3.1 rtthread 串口设备(V1)详解
Cubemx 移植正点原子LCD显示例程
Mysqldump data backup
Indicator system of KQI and KPI
MADDPG的pythorch实现——(1)OpenAI MADDPG环境配置
Cf603e pastoral oddities [CDQ divide and conquer, revocable and search set]
Pytoch foundation - (2) mathematical operation of tensor
SWC introduction
Map sorts according to the key value (ascending plus descending)
【FPGA教程案例12】基于vivado核的复数乘法器设计与实现
Take you to wechat applet development in 3 minutes
After five years of testing in byte, I was ruthlessly dismissed in July, hoping to wake up my brother who was paddling
Schnuka: 3D vision detection application industry machine vision 3D detection
遥感图像超分辨重建综述
SWC介绍
Suggestions for new engineer team members
SAP ALV color code corresponding color (finishing)