In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to use listBox control in WinForm, which is very detailed and has certain reference value. Friends who are interested must finish it!
The use of namespace _ 13.ListBox control
{
Public partial class Form1: Form
{
Public Form1 ()
{
InitializeComponent ()
}
/ / create a new collection object to store the full path of the picture
List list = new List ()
Private void Form1_Load (object sender, EventArgs e)
{
/ / when the program is running, load the picture into listBox
/ / get the full path of the folder where the picture is located
String [] path = Directory.GetFiles (@ "C:\ Users\ Administrator.USER-20180925HC\ Desktop\ pic", "* .jpg")
/ / load the picture into listBox for (int I = 0; I < path.Length; iTunes +) {/ / get the file name string fileName = Path.GetFileName (path [I]); listBox1.Items.Add (fileName) through a loop; / / add the full path of the picture to the List generic collection list.Add (path [I]) }} private void listBox1_DoubleClick (object sender, EventArgs e) {/ / double-click the listBox picture name, and the right pictureBox displays the corresponding picture pictureBox1.Image = Image.FromFile (listBox1.SelectedIndex]);}}
}
The above is all the content of the article "how to use listBox controls in WinForm". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.