線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1528
推到 Plurk!
推到 Facebook!

怎么办string型转成Tcaption型?

尚未結案
coldcoffee
一般會員


發表:60
回覆:22
積分:16
註冊:2003-05-23

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-01-14 22:46:10 IP:61.51.xxx.xxx 未訂閱
怎么办string型转成Tcaption型?
terrychen
尊榮會員


發表:90
回覆:794
積分:501
註冊:2003-05-01

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-01-14 23:02:15 IP:211.76.xxx.xxx 未訂閱
您好: The type of the Caption property. Unit Controls type TCaption = type string; Description TCaption is the string that represents the caption of a control. 所以應不需要轉吧!! 引述Delphi.Ktop風紀小隊---[ 發問前請先找找舊文章 ]---
coldcoffee
一般會員


發表:60
回覆:22
積分:16
註冊:2003-05-23

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-01-14 23:47:11 IP:61.51.xxx.xxx 未訂閱
引言: 您好: The type of the Caption property. Unit Controls type TCaption = type string; Description TCaption is the string that represents the caption of a control. 所以應不需要轉吧!! 引述Delphi.Ktop風紀小隊---[ 發問前請先找找舊文章 ]---
不传不行呀,我做了一个函数是列出某个目录下的所有子目录,这个函数接收string参数,如果有ShellTreeView1.Path告诉这个函数,只列出一级子目录,如果用edit1.text告诉这个函数,就能列出所有子目录,但是我必须要用ShellTreeView1这个控件,我的函数如下: procedure FindSubDirs(Path:string); var FindSubStr:tSearchrec; begin Memo1.Lines.add(path); if FindFirst(path '\' '*.*',faAnyFile,FindSubStr)=0 then begin repeat if (Trim(FindSubStr.Name)<>'.') and (Trim(FindSubStr.Name)<>'..') and (FindSubStr.Attr=faDirectory) then //若找到子目录就调用自身 FindSubDirs(Path FindSubStr.name '\'); //将下一层子目录名传入自身函数 until FindNext(FindSubStr)<>0; //找下一个目录名 FindClose(FindSubStr); end; end; 应该怎么转?
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#4 引用回覆 回覆 發表時間:2004-01-15 00:34:54 IP:218.163.xxx.xxx 未訂閱
//搜尋檔案列表(含子目錄搜尋) 網路資料之修正版
uses Masks;
...
procedure SearchInDir(Mask, Dir: string; Subdir: Boolean; var List: TStringList);
var
  r: integer;
  f: TSearchRec;
begin
  if Dir = '' then Exit;
  if Dir[Length(Dir)] <> '\' then Dir := Dir   '\';
{$I-}
  ChDir(Dir);
{$I }
  if IOResult <> 0 then Exit;
  r := FindFirst('*.*', faAnyFile, f);
  while r = 0 do
  begin
    if MatchesMask(f.Name, Mask) then
      if (f.Name <> '.') and (f.Name <> '..') then
        List.Add(ExpandFileName(f.Name));
    if (f.Attr and faDirectory) = faDirectory then
      if SubDir = True then
      begin
        if (f.Name <> '.') and (f.Name <> '..') then
        begin
          SearchInDir(Mask, ExpandFileName(f.Name), SubDir, List);
          ChDir(Dir);
        end;
      end;
    r := FindNext(f);
  end;
  FindClose(f);
end;    //Memo1使用方式:
procedure TForm1.Button1Click(Sender: TObject);
var
   Qoo:TStringList;
   i:integer;
begin
 Qoo:=TStringList.Create;
 SearchInDir('*.*','C:\' ,True , Qoo);
 for i:=0 to Qoo.Count-1 do
   Memo1.Lines.Add(Qoo[i]);
 Qoo.Free;
end;     
網海無涯,學無止境! 發表人 - qoo1234 於 2004/01/15 00:48:47
terrychen
尊榮會員


發表:90
回覆:794
積分:501
註冊:2003-05-01

發送簡訊給我
#5 引用回覆 回覆 發表時間:2004-01-15 00:37:46 IP:211.76.xxx.xxx 未訂閱
您好: 還是不太懂您的意思,可否在說明白一點 引述Delphi.Ktop風紀小隊---[ 發問前請先找找舊文章 ]---
lovelypp
初階會員


發表:122
回覆:111
積分:46
註冊:2003-02-19

發送簡訊給我
#6 引用回覆 回覆 發表時間:2004-01-15 12:13:43 IP:218.104.xxx.xxx 未訂閱
TCaption(str)
coldcoffee
一般會員


發表:60
回覆:22
積分:16
註冊:2003-05-23

發送簡訊給我
#7 引用回覆 回覆 發表時間:2004-01-15 19:56:50 IP:61.51.xxx.xxx 未訂閱
是我大意了,我知道错在那里了,谢谢个位了。
系統時間:2024-05-03 2:29:58
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!