很慢的秀圖程式 |
答題得分者是:william
|
2ujioggl
一般會員 發表:16 回覆:15 積分:6 註冊:2003-05-23 發送簡訊給我 |
各位大大安安
小弟有問題想問如下: String AppDir=ExtractFileDir(Application->ExeName);
int PicCounter=0; ImageList1->Clear();
ListView1->Items->Clear(); AnsiString path;
path="C:\\picture"; if(!FindFirst(path+"\\*.jpg",faAnyFile,sr)){ do{
TJPEGImage *pjpg = new TJPEGImage;
pjpg->LoadFromFile(path+"\\"+sr.Name); Graphics::TBitmap *bufbmp = new Graphics::TBitmap();
bufbmp->Width=90;
bufbmp->Height=90; bufbmp->Canvas->StretchDraw(Rect(1,1,89,89),pjpg);
plist=ListView1->Items->Add();
plist->Caption=sr.Name;
plist->ImageIndex=ImageList1->Add(bufbmp,NULL); PicCounter++; delete pjpg;
delete bufbmp;
} while(FindNext(sr)==0); ShowMessage(PicCounter); } 這樣可以show出jpg的圖檔但是,我試了一下它run的很久才會出現吶,
當jpg的圖檔越大run的越久,後來看站上高手寫的同性質的作品,他寫的這一支run的速度超快的功能也不錯,也有附source檔但是我看不懂delphi,想麻煩
可不可以翻成bcb的版本,因為我一次要秀出上百上千張的圖檔速度不快的話會
被唸^^
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=29612
|
william
版主 發表:66 回覆:2535 積分:3048 註冊:2002-07-11 發送簡訊給我 |
不用每次 create/destroy objects 吧,試一下:
String AppDir=ExtractFileDir(Application->ExeName); int PicCounter=0; ImageList1->Clear(); ListView1->Items->Clear(); AnsiString path; path="C:\\picture"; if(!FindFirst(path "\\*.jpg",faAnyFile,sr)){ TJPEGImage *pjpg = new TJPEGImage; Graphics::TBitmap *bufbmp = new Graphics::TBitmap(); bufbmp->Width=90; bufbmp->Height=90; ListView1->Items->BeginUpdate(); do{ pjpg->LoadFromFile(path "\\" sr.Name); bufbmp->Canvas->StretchDraw(Rect(1,1,89,89),pjpg); plist=ListView1->Items->Add(); plist->Caption=sr.Name; plist->ImageIndex=ImageList1->Add(bufbmp,NULL); PicCounter ; } while(FindNext(sr)==0); ListView1->Items->EndUpdate(); delete pjpg; delete bufbmp; ShowMessage(PicCounter); }可以的話,不要 Default draw ,善用 ListView 的 OnCustomDraw, OnCustomDrawItem, OnCustomDrawSubItem 等應會再快些少 |
2ujioggl
一般會員 發表:16 回覆:15 積分:6 註冊:2003-05-23 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |