语文教学网 加入收藏  -  设为首页
您的位置:语文教学网 > 知识 > 正文
C#中Listview的双击问题
C#中Listview的双击问题
提示:

C#中Listview的双击问题

private
void
Form1_Load(object
sender,
EventArgs
e)
{
listView1.LargeImageList
=
imageList1;
listView1.Items.Add("QQ");
listView1.Items[0].ImageIndex
=
0;
listView1.Items.Add("千千静听");
listView1.Items[1].ImageIndex
=
1;
}
private
void
listView1_DoubleClick(object
sender,
EventArgs
e)
{
if
(listView1.Items[0].Selected)
{
System.Diagnostics.Process.Start(@"C:\Program
Files\Tencent\QQ\Bin\QQ.exe");
}
else
{
System.Diagnostics.Process.Start(@"E:\软件包\TTPLAYER\TTPlayer.exe");
}
}相信你的问题就可以得到解决吧!

C#中listviewitem的点击事件如何把选中的item的tag传递到事件方法中去
提示:

C#中listviewitem的点击事件如何把选中的item的tag传递到事件方法中去

///
/// 双击选择播放列表项进行播放
///
///
///
private void lv_playlist_MouseDoubleClick(object sender, MouseEventArgs e)
{
ListViewHitTestInfo info = lv_playlist.HitTest(e.X, e.Y);
if (info.Item != null)
{
gbxplayer1.Text = "视频1";
player1.playlist.stop();
player1.playlist.items.clear();
var videoitem = info.Item as ListViewItem;
long geyeid = long.Parse(videoitem.SubItems[2].Text);

PlayVidoe(playlist[geyeid], playerList[0]);
SetGroupBoxTitle(playerListIndex[0], playlist[geyeid].puName);
}
}