选择显示字体大小

从windows资源管理器中拖动文件

这里我们主要简单的讨论一下,如何从windows资源管理器中拖动一组文本,然后将它们拖放到一个文本框控件中就可将文件全部打开。
为了说明这一点,以下过程可用一个文本框控件以及oledragover和oledragdrop事件,并用dataobject对象中的files属性和vbcffiles数据格式打开一组文本文件。

首先在visual basic中启动新的工程。向窗体添加一个文本框控件并将其oledropmode属性设置为"手工"。将multiline属性设置为true,将scrollbars设为2-vertical,并清除text属性

代码如下:

private sub text1_oledragdrop(data as dataobject, effect as long, button as integer, shift as integer, x as single, y as single)
if data.getformat(vbcffiles) then
for each vfn in data.files '循环打开文件
open vfn for input as #1
do while not eof(1)
line input #1, linefile
text1 = text1 & linefile & vbcrlf
loop
close #1
next vfn
end if
end sub

下列事件中,用getformat方法检测兼容的数据格式(vbcffiles)
private sub text1_oledragover(data as dataobject, effect as long, button as integer, shift as integer, x as single, y as single, state as integer)
if data.getformat(vbcffiles) then
'若数据格式正确,则把即将执行的操作通知源
effect = vbdropeffectcopy and effect '放下的结果为复制
exit sub
end if
'若数据格式不合适,则不放下
effect = vbdropeffectnone
end sub

原文出处:http://dev.csdn.net/article/29/29176.shtm


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons