当前位置:网站首页>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 :

边栏推荐
- How to modify field constraints (type, default, null, etc.) in a table
- Pytoch foundation - (1) initialization of tensors
- 【SLAM】ORB-SLAM3解析——跟踪Track()(3)
- RT thread -- FTP of LwIP (2)
- 施努卡:3d视觉检测应用行业 机器视觉3d检测
- 【Rust 笔记】18-宏
- [slam] lidar camera external parameter calibration (Hong Kong University marslab) does not need a QR code calibration board
- 阿里测试师用UI自动化测试实现元素定位
- Data analysis Seaborn visualization (for personal use)
- Alibaba testers use UI automated testing to achieve element positioning
猜你喜欢
![[risc-v] external interrupt](/img/9d/eb1c27e14045d9f1f690f4a7f5c596.jpg)
[risc-v] external interrupt

SWC introduction

No qualifying bean of type ‘......‘ available

SWC介绍

An article will give you a comprehensive understanding of the internal and external components of "computer"

RT thread -- FTP of LwIP (2)

Brush questions in summer -day3

MySQL about self growth

2.2 fonctionnement stm32 GPIO

多项目编程极简用例
随机推荐
Indicator system of KQI and KPI
Mysqldump data backup
Pytoch foundation - (1) initialization of tensors
User perceived monitoring experience
遥感图像超分辨重建综述
1.16 - check code
Exness foreign exchange: the governor of the Bank of Canada said that the interest rate hike would be more moderate, and the United States and Canada fell slightly to maintain range volatility
3.1 detailed explanation of rtthread serial port device (V1)
How to standardize the deployment of automated testing?
Record the process of reverse task manager
[prediction model] difference method model
SWC introduction
Codeforces Global Round 19
2.1 rtthread pin设备详解
Canvas cut blocks game code
数据分析——seaborn可视化(笔记自用)
Cubemx 移植正点原子LCD显示例程
mysql从一个连续时间段的表中读取缺少数据
3.2 detailed explanation of rtthread serial port device (V2)
Do you know cookies, sessions, tokens?