Delphi 2007 使用ShellTreeView控件


本文整理自网络,侵删。

  

Delphi 2007中默认没有ShellTreeView控件,但是有ShellCtrls,dcu单元,所以我们可以使用此单元然后动态创建这个Delphi 7中有的控件:

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,ShellCtrls,StdCtrls;

type
TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
private
    { Private declarations }
public
    { Public declarations }
end;

var
Form1: TForm1;
s:TShellTreeView;
implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
s:=TShellTreeView.Create(self);
s.ParentWindow:=Form1.Handle;
s.Name:='ShellTree1';
s.Left:=0;
s.Top:=0;
s.Width:=201;
s.Height:=209;
s.Root:='rfDesktop'; //rfMyComputer
end;

procedure TForm1.Button1Click(Sender: TObject);
begin

if DirectoryExists(s.path)then
caption:=s.Path;
end;

end.

相关阅读 >>

Delphi 在firemonkey应用程序中设置application.title

Delphi 创建自己的定时器 定时清理内存

Delphi ioutils 单元(6): tpath(结构体)路径的提取和处理

Delphi中带缓存的数据更新技术

Delphi的listview自动排序

Delphi dbnavigator1 模拟点击

Delphi 以低用户权限启动一个进程.比如vista或者win7中的ie

Delphi 下 vclzip控件的简单使用

Delphi打印timage图片

Delphi中自适应窗体的实现

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...