当前位置:网站首页>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
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 :
边栏推荐
- How to standardize the deployment of automated testing?
- SAP ALV color code corresponding color (finishing)
- Record the process of reverse task manager
- three. JS page background animation liquid JS special effect
- [rust notes] 18 macro
- Quartz misfire missed and compensated execution
- Alibaba testers use UI automated testing to achieve element positioning
- Image super resolution using deep revolutionary networks (srcnn) interpretation and Implementation
- Ethernet port &arm & MOS &push-pull open drain &up and down &high and low sides &time domain and frequency domain Fourier
- Ybtoj coloring plan [tree chain dissection, segment tree, tarjan]
猜你喜欢
【SLAM】ORB-SLAM3解析——跟踪Track()(3)
自动化测试怎么规范部署?
After five years of testing in byte, I was ruthlessly dismissed in July, hoping to wake up my brother who was paddling
C language circular statement
JS Vanke banner rotation chart JS special effect
On Data Mining
Ethernet port &arm & MOS &push-pull open drain &up and down &high and low sides &time domain and frequency domain Fourier
User experience index system
BUAA calculator (expression calculation - expression tree implementation)
Microkernel structure understanding
随机推荐
C#(二十九)之C#listBox checkedlistbox imagelist
1.16 - check code
[001] [stm32] how to download STM32 original factory data
2. GPIO related operations
C language circular statement
Image super-resolution using deep convolutional networks(SRCNN)解读与实现
Containerization Foundation
Introduction to DeNO
Why do you want to start pointer compression?
[slam] lidar camera external parameter calibration (Hong Kong University marslab) does not need a QR code calibration board
Differential GPS RTK thousand search
How do we make money in agriculture, rural areas and farmers? 100% for reference
Serial port-rs232-rs485-ttl
Mysqldump data backup
2.1 rtthread pin设备详解
Image super resolution using deep revolutionary networks (srcnn) interpretation and Implementation
Oracle ORA error message
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
EDCircles: A real-time circle detector with a false detection control 翻译
JS Vanke banner rotation chart JS special effect