首页 > 其他 > 详细

Chapter 5. ListBox控件(双击播放图片)

时间:2016-07-05 01:04:23      阅读:313      评论:0      收藏:0      [点我收藏+]

技术分享

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace ListBox控件
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void Form2_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < path.Length; i++)
            {
                string fileName = Path.GetFileName(path[i]);
                listBox1.Items.Add(fileName);
            }
        }

        string[] path = Directory.GetFiles(@"C:\Users\Administrator\Desktop\新建文件夹");

        //双击播放图片
        private void listBox1_DoubleClick(object sender, EventArgs e)
        {
            pictureBox1.Image = Image.FromFile(path[listBox1.SelectedIndex]);
        }
    }
}

技术分享

技术分享

技术分享

 

Chapter 5. ListBox控件(双击播放图片)

原文:http://www.cnblogs.com/xiao55/p/5642042.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!