当前位置:网站首页>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 :
边栏推荐
- Blue style mall website footer code
- Facebook等大廠超十億用戶數據遭泄露,早該關注DID了
- 2.1 rtthread pin设备详解
- Facebook and other large companies have leaked more than one billion user data, and it is time to pay attention to did
- Take you to wechat applet development in 3 minutes
- 关于非虚函数的假派生
- 2. GPIO related operations
- Cubemx transplantation punctual atom LCD display routine
- Oracle ORA error message
- 2.13 weekly report
猜你喜欢
施努卡:视觉定位系统 视觉定位系统的工作原理
Mysqldump data backup
C language circular statement
Ethernet port &arm & MOS &push-pull open drain &up and down &high and low sides &time domain and frequency domain Fourier
Svg drag point crop image JS effect
[risc-v] external interrupt
2.2 STM32 GPIO操作
Four logs of MySQL server layer
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
mysql关于自增长增长问题
随机推荐
C#(二十八)之C#鼠标事件、键盘事件
No qualifying bean of type ‘......‘ available
Yyds dry inventory what is test driven development
Containerization Foundation
Alibaba testers use UI automated testing to achieve element positioning
Oracle ORA error message
2.13 weekly report
Facebook and other large companies have leaked more than one billion user data, and it is time to pay attention to did
KS008基于SSM的新闻发布系统
Exchange bottles (graph theory + thinking)
【SLAM】lidar-camera外参标定(港大MarsLab)无需二维码标定板
RT thread -- FTP of LwIP (2)
Prime Protocol宣布在Moonbeam上的跨链互连应用程序
Python implementation of maddpg - (1) openai maddpg environment configuration
3分钟带你了解微信小程序开发
Do you know cookies, sessions, tokens?
BUAA magpie nesting
2.2 STM32 GPIO operation
[prediction model] difference method model
Cross origin cross domain request