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

边栏推荐
- Flask learning and project practice 9: WTF form verification
- Oracle ORA error message
- BUAA calculator (expression calculation - expression tree implementation)
- JS music online playback plug-in vsplayaudio js
- 3分钟带你了解微信小程序开发
- [slam] orb-slam3 parsing - track () (3)
- 【按键消抖】基于FPGA的按键消抖模块开发
- Shell pass parameters
- Record the process of reverse task manager
- [practical exercise] face location model based on skin color
猜你喜欢

Ethernet port &arm & MOS &push-pull open drain &up and down &high and low sides &time domain and frequency domain Fourier

C language judgment, ternary operation and switch statement usage

Image super-resolution using deep convolutional networks(SRCNN)解读与实现

UDP reliable transport protocol (quic)

Pointer written test questions ~ approaching Dachang

Suggestions for new engineer team members
![P7735-[noi2021] heavy and heavy edges [tree chain dissection, line segment tree]](/img/b1/dbfc42d66548476300501dd839abef.jpg)
P7735-[noi2021] heavy and heavy edges [tree chain dissection, line segment tree]

Microkernel structure understanding

Map sorts according to the key value (ascending plus descending)

Flask learning and project practice 9: WTF form verification
随机推荐
Image super-resolution using deep convolutional networks(SRCNN)解读与实现
3.2 rtthread 串口设备(V2)详解
[American competition] mathematical terms
SAP ALV color code corresponding color (finishing)
No qualifying bean of type ‘......‘ available
ESBuild & SWC浅谈: 新一代构建工具
1. New project
Plus d'un milliard d'utilisateurs de grandes entreprises comme Facebook ont été compromis, il est temps de se concentrer sur le did
暑期刷题-Day3
Do you know cookies, sessions, tokens?
MySQL 中的数据类型介绍
【Rust 笔记】18-宏
Crawler of explanation and application of agency theory
The solution of permission denied (750 permissions should be used with caution)
cookie,session,Token 这些你都知道吗?
Facebook等大廠超十億用戶數據遭泄露,早該關注DID了
简述C语言中的符号和链接库
After five years of testing in byte, I was ruthlessly dismissed in July, hoping to wake up my brother who was paddling
An article will give you a comprehensive understanding of the internal and external components of "computer"
【SLAM】lidar-camera外参标定(港大MarsLab)无需二维码标定板