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; namespace FileStyle
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} public void Data_List(ListView LV, string F)
{
string Format = "";
if (F.LastIndexOf(".") == F.Length - 4)
Format = F.Substring(F.LastIndexOf(".") + 1, 3);
ListViewItem item = new ListViewItem(F);
item.SubItems.Add(Format);
LV.Items.Add(item);
} private void listView1_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Copy;
String[] str_Drop = (String[])e.Data.GetData(DataFormats.FileDrop, true);//必须用字符串数组
Data_List(listView1, str_Drop[0]);
} private void Form1_Shown(object sender, EventArgs e)
{
listView1.GridLines = true;
listView1.View = View.Details;//显示列名称
listView1.FullRowSelect = true;
listView1.HeaderStyle = ColumnHeaderStyle.Nonclickable;//隐藏列标题
listView1.Columns.Add("文件名称", listView1.Width - 65, HorizontalAlignment.Right);
listView1.Columns.Add("类型", 60, HorizontalAlignment.Center);
}
}
}

C#文件拖放至窗口的ListView控件获取文件类型的更多相关文章

  1. PyQt学习随笔:ListView控件获取当前选择项的方法

    通过currentIndex()可以获取listView控件的当前选择元素,如果选择了多个,则可以通过selectedIndexes()来获取选择的元素,不过这两个函数返回的是元素数据,而不是索引编号 ...

  2. C# ListView 控件和 INotifyPropertyChanged 接口

    ListView 控件和 DataGridView 控件 ListView 是跟 Winform 中 DataGridView 用法以及显示效果差不多的一个 WPF 控件,可以通过列表的方式方便的显示 ...

  3. ListView 控件和 INotifyPropertyChanged 接口

    原文:ListView 控件和 INotifyPropertyChanged 接口 ListView 控件和 DataGridView 控件 ListView 是跟 Winform 中 DataGri ...

  4. winform利用ImageList控件和ListView控件组合制作图片文件浏览器

    winform利用ImageList控件和ListView控件组合制作图片文件浏览器,见图,比较简单,实现LISTVIEW显示文件夹图片功能. 1.选择文件夹功能代码: folderBrowserDi ...

  5. 读取其他软件listview控件的内容

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  6. Windows常见窗口样式和控件风格

    Windows常见窗口样式和控件风格 王佰营 徐丽红 一.窗口样式 WS_POPUP 弹出式窗口(不能与WS_CHILDWINDOW样式同时使用)WS_CHILDWINDOW 子窗口(不能与WS_PO ...

  7. PyQt学习随笔:ListView控件的视图和数据模型分离案例

    Qt 中view类控件的目的是实现数据和模型分离,控件展示数据,数据保存在数据存储中,数据存储中的数据改变了,则控件中展示的数据跟随改变.当设计时只指定了一个控件和一个数据存储关联时,这种分离虽然也能 ...

  8. ListView控件

      打气筒工具:将R.layout.item_listview布局添加到相应的view控件里面 View view=LayoutInflater.from(ScondPro.this).inflate ...

  9. Android中ListView控件的使用

    Android中ListView控件的使用 ListView展示数据的原理 在Android中,其实ListView就相当于web中的jsp,Adapter是适配器,它就相当于web中的Servlet ...

随机推荐

  1. 接口测试工具篇--jmeter

    jmeter的安装及使用在这里不进行讲解了,网上有很多资料 下面开始讲解如何使用jmeter做http接口测试 在jmeter中添加一个http请求,添加方式:测试计划上邮件添加线程组,线程组上邮件选 ...

  2. 基本数据类型(int,bool,str)

    1.int bit_lenth() 计算整数在内存中占用的二进制码的长度 十进制 二进制 长度(bit_lenth()) 1 1 1 2 10 2 4 100 3 8 1000 4 16 10000 ...

  3. c的面向对象思想记录

    在一家公司做实习生,努力学习,keep moving. //c1.h typedef struct { +]; int (*tr)(); } trans; //c1.c #include<str ...

  4. angular.js和vue.js中实现函数去抖(debounce)

    问题描述 搜索输入框中,只当用户停止输入后,才进行后续的操作,比如发起Http请求等. 学过电子电路的同学应该知道按键防抖.原理是一样的:就是说当调用动作n毫秒后,才会执行该动作,若在这n毫秒内又调用 ...

  5. pandas 3 设置值

    from __future__ import print_function import pandas as pd import numpy as np np.random.seed(1) dates ...

  6. 使用Qt.labs.settings来存储应用的设置

    我在曾经的文章中,讲述了怎样使用U1db及SQLite offline storage API来存储应用的一些状态.在这篇文章中,我将介绍怎样使用Qt.labs.settings来存储应用的状态.更加 ...

  7. node04---fs文件操作、静态服务器

    08fs.js var http = require("http"); var fs = require("fs"); var server = http.cr ...

  8. angularjs 表单校验

    <!DOCTYPE HTML> <html ng-app="myApp"> <head> <meta http-equiv="C ...

  9. Kali linux 2016.2(Rolling)中metasploit的搜集特定地址的邮件地址

    不多说,直接上干货! 使用search_email_collector搜集特定地址的邮件地址 search_email_collector 要求提供一个邮箱后缀,通过多个搜索引擎的查询结果分析使用此后 ...

  10. animation和transition做动画的区别

    animation做动画,是不需要去触发的,可以定义一开始就执行 transition做动画,是需要人为触发,才能执行的