C#文件拖放至窗口的ListView控件获取文件类型
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控件获取文件类型的更多相关文章
- PyQt学习随笔:ListView控件获取当前选择项的方法
通过currentIndex()可以获取listView控件的当前选择元素,如果选择了多个,则可以通过selectedIndexes()来获取选择的元素,不过这两个函数返回的是元素数据,而不是索引编号 ...
- C# ListView 控件和 INotifyPropertyChanged 接口
ListView 控件和 DataGridView 控件 ListView 是跟 Winform 中 DataGridView 用法以及显示效果差不多的一个 WPF 控件,可以通过列表的方式方便的显示 ...
- ListView 控件和 INotifyPropertyChanged 接口
原文:ListView 控件和 INotifyPropertyChanged 接口 ListView 控件和 DataGridView 控件 ListView 是跟 Winform 中 DataGri ...
- winform利用ImageList控件和ListView控件组合制作图片文件浏览器
winform利用ImageList控件和ListView控件组合制作图片文件浏览器,见图,比较简单,实现LISTVIEW显示文件夹图片功能. 1.选择文件夹功能代码: folderBrowserDi ...
- 读取其他软件listview控件的内容
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- Windows常见窗口样式和控件风格
Windows常见窗口样式和控件风格 王佰营 徐丽红 一.窗口样式 WS_POPUP 弹出式窗口(不能与WS_CHILDWINDOW样式同时使用)WS_CHILDWINDOW 子窗口(不能与WS_PO ...
- PyQt学习随笔:ListView控件的视图和数据模型分离案例
Qt 中view类控件的目的是实现数据和模型分离,控件展示数据,数据保存在数据存储中,数据存储中的数据改变了,则控件中展示的数据跟随改变.当设计时只指定了一个控件和一个数据存储关联时,这种分离虽然也能 ...
- ListView控件
打气筒工具:将R.layout.item_listview布局添加到相应的view控件里面 View view=LayoutInflater.from(ScondPro.this).inflate ...
- Android中ListView控件的使用
Android中ListView控件的使用 ListView展示数据的原理 在Android中,其实ListView就相当于web中的jsp,Adapter是适配器,它就相当于web中的Servlet ...
随机推荐
- 在vue组件中style scoped中遇到的坑
在uve组件中我们我们经常需要给style添加scoped来使得当前样式只作用于当前组件的节点.添加scoped之后,实际上vue在背后做的工作是将当前组件的节点添加一个像data-v-1233这样唯 ...
- Mybatis中<resultMap>用法(主要用于一对多去重)
一.创建部门表和员工表: 创建部门信息表`t_department`,其中包括`id`, `name` CREATE TABLE t_department ( id INT AUTO_ ...
- -bash: nginx: 未找到命令 (command not found) 解决方案
昨天在linux中安装了 nginx ,并按照网上教程 进行启动 如: ps -ef | grep nginx 可以查看到 我就想重新加载一次 如:提示我找不到 nginx 命令 -c参数指定了要加载 ...
- 用Maven+IDEA+Eclipse组合获得最好的OpenJML体验
OpenJML+SMTSolver的形式化验证想必大家都已经尝试过了.大家或许体验的更多的是IDEA上命令行输出版本的OpenJML插件,但真正得到官方支持的完全版OpenJML是它的Eclipse版 ...
- java用freemarker实现导出word----包含图片
分为以下三个步骤: 1.先制作word模板 2.将该文档另存为 xml 文件 3.打开xml 文件 将对应的字段替换,比如 4.将xml文件保存成ftl格式的文档 5.相应的代码: package o ...
- HDU 5607 graph(矩阵优化+概率DP)
该题非常easy想到求概率的转移方程:用d[i][j]表示第i步,走到j点的概率. 可是该题的k高达1e9.所以依照套路.要用矩阵相乘来优化. 第一次写矩阵相乘. 大概的意思就是利用矩阵实现递推. 而 ...
- 安装xcode6 beta 后调试出现Unable to boot the iOS Simulator以及编译苹果官方Swift的demo报错failed with exit code 1的解决的方法
苹果昨天公布新语言Swift(雨燕),须要安装xcode6 以及mac os 系统为10.9以上. (xcode6 beta 可在官方下载.须要登录开发人员账号:mac os 系统直接更新就可以.在此 ...
- 【翻译自mos文章】开启dblink的 oracle net trace/tracing --对dblink进行跟踪的方法
开启dblink的 oracle net trace/tracing --对dblink进行跟踪的方法. 參考原文: DBLINK: How to Enable Oracle Net Tracing ...
- 单点登录(二)使用Cookie+File实现单点登录登出(附源代码)
上一篇文章<单点登录(一)使用Cookie+File实现单点登录>中,我们实现了单点登录的功能. 本文作为上一篇文章的扩展部分,加入"单点登出"功能. 源代码下载:链接 ...
- hdoj--1869--六度分离(floyd)
六度分离 Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submi ...