Table -> StringGrid 問題 |
缺席
|
cmf
尊榮會員 發表:84 回覆:918 積分:1032 註冊:2002-06-26 發送簡訊給我 |
以下作法 速度很慢 若有1000筆 以上都需花十幾分鐘以上
請問有什麼方法能較快 從 Table 載入 StringGrid for i:=0 to Table2.RecordCount-1 do
begin
StringGrid1.RowCount:= j 1;
StringGrid1.Cells[0,j]:= Table2.FieldByName('DIFF').Asstring;
StringGrid1.Cells[1,j]:= Table2.FieldByName('X1').Asstring;
StringGrid1.Cells[2,j]:= Table2.FieldByName('Y1').Asstring;
StringGrid1.Cells[3,j]:= Table2.FieldByName('X2').Asstring;
StringGrid1.Cells[4,j]:= Table2.FieldByName('Y2').Asstring;
StringGrid1.Cells[5,j]:= Table2.FieldByName('P').Asstring;
StringGrid1.Cells[6,j]:= Table2.FieldByName('備註').AsString;
StringGrid1.Row:=j; if PDM.Table2.FieldByName('P').AsBoolean =TRUE then INC(g)
else INC(b); if i< (Table2.RecordCount-1) then Table2.Next;
inc(j); application.ProcessMessages;
end;
------
︿︿ |
william
版主 發表:66 回覆:2535 積分:3048 註冊:2002-07-11 發送簡訊給我 |
Filling string grid is very slow, there exist several free string grid replacement which should speed up the process. However, another way is to NOT filling the cells. Making use of the OnDrawCell event will be faster since there is no need to fetch and fill all records at once, but you need to handle all the drawing yourself then.
|
chih
版主 發表:48 回覆:1186 積分:639 註冊:2002-04-02 發送簡訊給我 |
|
william
版主 發表:66 回覆:2535 積分:3048 註冊:2002-07-11 發送簡訊給我 |
|
chih
版主 發表:48 回覆:1186 積分:639 註冊:2002-04-02 發送簡訊給我 |
|
richcomp
中階會員 發表:18 回覆:66 積分:51 註冊:2002-10-18 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |