我用ShellTreeView选择一个目录,
Edit1.Text:=ShellTreeView1.SelectedFolder.PathName;
这段代码能把选择的目录路径赋到Edit1.text上,但选跟目录时(驱动器:C:,D:,E:....)
Edit上的值为‘C:\’
但选目录时,Edit上值为‘C:\windows’,最后没有‘\’,请问要怎么样才能让不管选哪个,最后都是‘\’我用Edit1.Text:=ShellTreeView1.SelectedFolder.PathName+'\';
这样目录是好了,但选驱动器时就变成‘C:\\’,有两个'\'了希望大侠们帮小弟个忙

解决方案 »

  1.   

    还有个问题我在Form1的一个Button上新建一个窗口Application.CreateForm(TForm2, Form2);在Form2的 onClose中写Action:=caFree;  按理说这样应该能在Form2关闭时将Form2全部释放掉那我在Form2的一个Button事件中写close, 按下Button后是不是也能对Form2完全释放??
    如果不在onClose中写Action:=caFree,那close会不会释放Form2的资源
      

  2.   

    1.
      with  ShellTreeView1.SelectedFolder do
      if PathName[Length(PathName) -1] <> '\' then
        Edit1.Text:=  PathName + '\'
      else
        Edit1.Text:=  PathName
    2.在Form2的 onClose中写Action:=caFree;  按理说这样应该能在Form2关闭时将Form2全部释放掉那我在Form2的一个Button事件中写close, 按下Button后是不是也能对Form2完全释放??
    --是
    如果不在onClose中写Action:=caFree,那close会不会释放Form2的资源
    ---窗体close时不释放, 在程序close时释放
      

  3.   

    1.加一个判断就可以了
    s:=ShellTreeView1.SelectedFolder.PathName;
    if copy(s,Length(s),1)<>'\' then
    s:=s+'\';close 和free不一样