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

边栏推荐
- 2.2 STM32 GPIO operation
- Blue Bridge Cup - Castle formula
- mysql从一个连续时间段的表中读取缺少数据
- RT thread -- FTP of LwIP (2)
- LTE CSFB test analysis
- 2.1 rtthread pin device details
- 简述C语言中的符号和链接库
- Crawler of explanation and application of agency theory
- 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
- Deno介绍
猜你喜欢

数据分析——seaborn可视化(笔记自用)

2.2 fonctionnement stm32 GPIO

C#(二十九)之C#listBox checkedlistbox imagelist

教你用Pytorch搭建一个自己的简单的BP神经网络( 以iris数据集为例 )

Blue style mall website footer code

KS003基于JSP和Servlet实现的商城系统

JS Vanke banner rotation chart JS special effect

自动化测试怎么规范部署?

2.1 rtthread pin device details

three. JS page background animation liquid JS special effect
随机推荐
[meisai] meisai thesis reference template
Serial port-rs232-rs485-ttl
Cross origin cross domain request
Failure causes and optimization methods of LTE CSFB
3.2 detailed explanation of rtthread serial port device (V2)
Pytorch基础——(2)张量(tensor)的数学运算
C#(二十七)之C#窗体应用
1.16 - check code
three. JS page background animation liquid JS special effect
潘多拉 IOT 开发板学习(HAL 库)—— 实验9 PWM输出实验(学习笔记)
An article will give you a comprehensive understanding of the internal and external components of "computer"
Pointer written test questions ~ approaching Dachang
给新人工程师组员的建议
3.1 detailed explanation of rtthread serial port device (V1)
暑期刷题-Day3
Exchange bottles (graph theory + thinking)
1. New project
Crawler of explanation and application of agency theory
Do you know cookies, sessions, tokens?
cookie,session,Token 这些你都知道吗?