CheckListBox的捲軸 |
尚未結案
|
may
一般會員 發表:32 回覆:26 積分:11 註冊:2003-02-11 發送簡訊給我 |
|
cashxin2002
版主 發表:231 回覆:2555 積分:1937 註冊:2003-03-28 發送簡訊給我 |
|
may
一般會員 發表:32 回覆:26 積分:11 註冊:2003-02-11 發送簡訊給我 |
對不起,我不太懂Column這句話的意思,我的程式是這樣寫的。
CheckListBox1.Items.Clear ;
with Table1 do begin
Active :=false;
Active :=true;
end;
while not Table1.Eof do begin
S1:=trim(Table1.fields[0].value);
S2:=trim(Table1.fields[2].value);
S:=S S1 ' , ' S2;
CheckListBox1.Items.add (S);
s:= '';
Table1.Next ;
end;
其中S所組合的字串長度會超過CheckListBox1的寬度,此時希望能出現左右捲軸。
|
cashxin2002
版主 發表:231 回覆:2555 積分:1937 註冊:2003-03-28 發送簡訊給我 |
您好﹗ CheckListBox1.Items.Clear ;
with Table1 do begin
Active :=false;
Active :=true;
end;
while not Table1.Eof do begin
S1:=trim(Table1.fields[0].value);
S2:=trim(Table1.fields[2].value);
S:=S + S1 + ' , ' +S2;
CheckListBox1.Items.add (S);
CheckListBox1.Columns := 1;
s:= '';
Table1.Next ;
end; Try it please! =====================
努力,相信會獲得美麗!
忻晟
------
忻晟 |
sos_admin
版主 發表:121 回覆:697 積分:768 註冊:2003-07-23 發送簡訊給我 |
|
may
一般會員 發表:32 回覆:26 積分:11 註冊:2003-02-11 發送簡訊給我 |
|
cashxin2002
版主 發表:231 回覆:2555 積分:1937 註冊:2003-03-28 發送簡訊給我 |
您好﹗ 小弟有測試過﹐應該可以啊﹒ 當Columns的屬性不等于0時﹐當Items中內容的寬度大于CheckListBox的寬度時﹐左右的捲軸就會自動出現﹒ 如果Columns的屬性等于0時﹐當Items中內容的高度大于CheckListBox的高度時﹐上下的捲軸就會自動出現﹒ 但左右的捲軸和上下的捲軸不會同時出現﹒ 您可以試一下﹐加入一個新的CheckListBox元件﹐再在Items中輸入內容(盡量多輸入一些﹐以作測試)﹐而后將其的Columns屬性值分別設為0和1﹐您就會發現其不同之處了﹒就您的問題﹐應該只需要將Columns屬性值設為1即可﹒ 參考看看﹗ =====================
努力,相信會獲得美麗!
忻晟
------
忻晟 |
hagar
版主 發表:143 回覆:4056 積分:4445 註冊:2002-04-14 發送簡訊給我 |
兩種方式:
var iScrollBarWidth: integer; begin CheckListBox1.Items.Add('測試測試測試測試測試測試測試測試測試測試'); iScrollBarWidth := CheckListBox1.Canvas.TextWidth('測試測試測試測試測試測試測試測試測試測試'); // 注意, iScrollBarWidth 的值要比 CheckListBox1.Width 的值來得大 // if 內的 20 是大約計算前面可以打勾那個方格的寬度 if iScrollBarWidth 20 > CheckListBox1.Width then begin SendMessage(CheckListBox1.Handle, LB_SETHORIZONTALEXTENT, iScrollBarWidth 20, 0); // 或 CheckListBox1.Perform(LB_SETHORIZONTALEXTENT, iScrollBarWidth 20, 0); end; end;不過, 要在 Columns 值為 0 時才有效 --- 歡迎光臨 ><>@>> 發表人 - |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |