当前位置:网站首页>C (XXIX) C listbox CheckedListBox Imagelist
C (XXIX) C listbox CheckedListBox Imagelist
2022-07-06 03:47:00 【camellias_】
listBox attribute :
Items: All options
SelectionMode: Whether to support multiple selection
(1):one You can only choose one
(2):Multisimple Multiple choices available
(3):MultExtended Press the key combination to select more
(4):none There is no choice
Multicolnum:
true: Support horizontal arrangement
false: Horizontal arrangement is not supported
SelectedIndex
listbox The index of the option is from 0 At the beginning of the alignment .
Checklistbox
Items: All options
CheckOnClick
False: You need to double-click to select the option
True: Click to select the option
Imagelist Components
Images:
Set of pictures in the component Use an array to represent
![[ 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-CBeNjYHK-1655864764074)(https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/d545a3c973ff45d0b1eb310cb4b34549~tplv-k3u1fbpfcp-zoom-1.image "1555393498465220.png")]](/img/b2/8186cea1d3c554a9ef649ef0df147c.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 putButton_Click(object sender, EventArgs e)
{
int index = listBox1.SelectedIndex;
if(index == 0)
{
result.Text = listBox1.SelectedItem.ToString();
}
else if(index == 1)
{
result.Text = listBox1.SelectedItem.ToString();
}
else if (index == 2)
{
result.Text = listBox1.SelectedItem.ToString();
}
else
{
MessageBox.Show(" Please choose the option ");
}
}
/**
* Add a button
*/
private void Add_Click(object sender, EventArgs e)
{
listBox1.Items.Add(Input.Text);
Input.Clear();
}
/**
* Remove button
*/
private void Remove_Click(object sender, EventArgs e)
{
int sel = listBox1.SelectedIndex;
if (sel != -1)
{
listBox1.Items.RemoveAt(listBox1.SelectedIndex);
}
else
{
MessageBox.Show(" Please select the option you want to remove ");
}
}
/**
* Clear button
*/
private void Clear_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
}
/**
* Check box default event
* Check the text to execute ( Don't modify CheckOnClick You need to double-click to check the attribute )
*/
private void fubox_SelectedIndexChanged(object sender, EventArgs e)
{
}
/**
* Check box default event
* Select the text ( Don't tick ) Will execute
*/
private void fubox_ItemCheck(object sender, ItemCheckEventArgs e)
{
// e It's a parameter object , Equal to the selected value
if (e.NewValue == CheckState.Checked)
{
// Selected primary key ( Select to display the picture )
switch (e.Index)
{
case 0: pictureBox1.Image = imageList1.Images[0]; break;
case 1: pictureBox2.Image = imageList1.Images[1]; break;
case 2: pictureBox3.Image = imageList1.Images[2]; break;
case 3: pictureBox4.Image = imageList1.Images[3]; break;
}
}
else
{
// Unselected primary key ( After removing the selection, the picture disappears )
switch (e.Index)
{
case 0: pictureBox1.Image = null; break;
case 1: pictureBox2.Image = null; break;
case 2: pictureBox3.Image = null; break;
case 3: pictureBox4.Image = null; break;
}
}
}
}
}
There are good suggestions , Please enter your comments below .
Welcome to personal blog
https://guanchao.site
Welcome to the applet :

边栏推荐
- JS Vanke banner rotation chart JS special effect
- User experience index system
- A brief introduction to symbols and link libraries in C language
- Plus d'un milliard d'utilisateurs de grandes entreprises comme Facebook ont été compromis, il est temps de se concentrer sur le did
- 遥感图像超分辨重建综述
- On Data Mining
- Alibaba testers use UI automated testing to achieve element positioning
- 2.1 rtthread pin设备详解
- Remote Sensing Image Super-resolution and Object Detection: Benchmark and State of the Art
- mysql关于自增长增长问题
猜你喜欢

Brush questions in summer -day3

Pytorch基础——(1)张量(tensor)的初始化

如何修改表中的字段约束条件(类型,default, null等)

C#(三十)之C#comboBox ListView treeView

Canvas cut blocks game code

Data analysis Seaborn visualization (for personal use)

多项目编程极简用例

【按键消抖】基于FPGA的按键消抖模块开发

Schnuka: 3D vision detection application industry machine vision 3D detection

Blue Bridge Cup - day of week
随机推荐
Pytorch基础——(1)张量(tensor)的初始化
Yyds dry inventory what is test driven development
关于非虚函数的假派生
Blue Bridge Cup - day of week
UDP reliable transport protocol (quic)
【FPGA教程案例12】基于vivado核的复数乘法器设计与实现
RT thread -- FTP of LwIP (2)
施努卡:什么是视觉定位系统 视觉系统如何定位
暑期刷题-Day3
Ethernet port &arm & MOS &push-pull open drain &up and down &high and low sides &time domain and frequency domain Fourier
Mysqldump data backup
Prime protocol announces cross chain interconnection applications on moonbeam
Flask learning and project practice 9: WTF form verification
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
Plus d'un milliard d'utilisateurs de grandes entreprises comme Facebook ont été compromis, il est temps de se concentrer sur le did
How to modify field constraints (type, default, null, etc.) in a table
Mathematical modeling regression analysis relationship between variables
Shell pass parameters
遥感图像超分辨重建综述