C# 能把程序的快捷方式放在WINFORM窗体中

来源:百度知道 编辑:UC知道 时间:2024/05/28 12:51:35
能把程序的快捷方式放在winform窗体中,双击能启动,也能添加,能给我一个实例教程最好

拖一个 ListView 控件,Id不要改。分别添加事件:MouseDoubleClick,DragEnter,DragDrop,DoubleClick

完成后代码如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;

namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void listView1_MouseDoubleClick(object sender, MouseEventArgs e)
{

}

private void listView1_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.All;
}

private void listView1_DragDrop(object sender, DragEventArgs e)
{
object obj = e.Data.GetData(DataFormats.FileDrop);