怎样控制TSTRINGGRID的滚动条的上下移动。 |
答題得分者是:wameng
|
cxg
中階會員 ![]() ![]() ![]() 發表:116 回覆:192 積分:76 註冊:2004-02-12 發送簡訊給我 |
|
Fishman
尊榮會員 ![]() ![]() ![]() ![]() ![]() ![]() 發表:120 回覆:1949 積分:2163 註冊:2006-10-28 發送簡訊給我 |
Hi cxg, Hope helpful :
procedure TForm1.Button1Click(Sender: TObject); begin if StringGrid1.Row >= 1 then StringGrid1.Row := StringGrid1.Row - 1; end; procedure TForm1.Button2Click(Sender: TObject); begin if StringGrid1.Row < (StringGrid1.RowCount -1) then StringGrid1.Row := StringGrid1.Row 1; end;
------
Fishman |
cxg
中階會員 ![]() ![]() ![]() 發表:116 回覆:192 積分:76 註冊:2004-02-12 發送簡訊給我 |
引言: Hi cxg, Hope helpful :procedure TForm1.Button1Click(Sender: TObject); begin if StringGrid1.Row >= 1 then StringGrid1.Row := StringGrid1.Row - 1; end; procedure TForm1.Button2Click(Sender: TObject); begin if StringGrid1.Row < (StringGrid1.RowCount -1) then StringGrid1.Row := StringGrid1.Row 1; end; |
wameng
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:31 回覆:1336 積分:1188 註冊:2004-09-16 發送簡訊給我 |
如果只移動滾動條,可用
// 上移
SendMessage(StringGrid1.Handle,WM_VSCROLL,SB_LINEUP,0);
// 下移
SendMessage(StringGrid1.Handle,WM_VSCROLL,SB_LINEDOWN,0);
// 最上
SendMessage(StringGrid1.Handle,WM_VSCROLL,SB_TOP,0);
// 最下
SendMessage(StringGrid1.Handle,WM_VSCROLL,SB_BOTTOM,0); 參考 ~~~~~~~~~~~
難得聰明,常常糊塗。
~~~~~~~~~~~
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |