当前位置:网站首页>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 :
边栏推荐
- [American competition] mathematical terms
- Image super resolution using deep revolutionary networks (srcnn) interpretation and Implementation
- An article will give you a comprehensive understanding of the internal and external components of "computer"
- Remote Sensing Image Super-resolution and Object Detection: Benchmark and State of the Art
- Cf464e the classic problem [shortest path, chairman tree]
- MySQL about self growth
- Ethernet port &arm & MOS &push-pull open drain &up and down &high and low sides &time domain and frequency domain Fourier
- After five years of testing in byte, I was ruthlessly dismissed in July, hoping to wake up my brother who was paddling
- 3.2 detailed explanation of rtthread serial port device (V2)
- Schnuka: what is visual positioning system and how to position it
猜你喜欢
Schnuka: 3D vision detection application industry machine vision 3D detection
Image super resolution using deep revolutionary networks (srcnn) interpretation and Implementation
在 .NET 6 中使用 Startup.cs 更简洁的方法
Facebook等大廠超十億用戶數據遭泄露,早該關注DID了
How to standardize the deployment of automated testing?
Edcircles: a real time circle detector with a false detection control translation
BUAA计算器(表达式计算-表达式树实现)
C#(二十八)之C#鼠标事件、键盘事件
C language -- structs, unions, enumerations, and custom types
Plus d'un milliard d'utilisateurs de grandes entreprises comme Facebook ont été compromis, il est temps de se concentrer sur le did
随机推荐
【Qt5】Qt QWidget立刻出现并消失
【FPGA教程案例12】基于vivado核的复数乘法器设计与实现
LTE CSFB test analysis
遥感图像超分辨率论文推荐
Pointer for in-depth analysis (problem solution)
Deno介绍
1. New project
SWC introduction
Blue style mall website footer code
有条件地 [JsonIgnore]
Pytoch foundation - (1) initialization of tensors
[risc-v] external interrupt
如何修改表中的字段约束条件(类型,default, null等)
[slam] orb-slam3 parsing - track () (3)
Cubemx transplantation punctual atom LCD display routine
Map sorts according to the key value (ascending plus descending)
Basic concepts of LTE user experience
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
[prediction model] difference method model
Take you to wechat applet development in 3 minutes