TScrollBox::VertScrollBar 的 Range 與 Position 問題 |
缺席
|
linly
一般會員 發表:42 回覆:37 積分:15 註冊:2007-10-07 發送簡訊給我 |
不知道有沒有人也遇過這樣的問題,當我去看 BCB Help 得到的說明是:
Range represents the virtual size (in pixels) of the associated control's client area. For example, if the Range of a form's horizontal scroll bar is set to 500, and the width of the form is 200, the scroll bar's Position can vary from 0 to 300. 做了以下實驗,發現 Position 最大值會多出4,也就是用以上範例的話,範圍是 [0,304],請問這是正常現象嗎?還是我哪裡搞錯了,請指正,謝謝 Unit.h [code cpp] class TForm1 : public TForm { __published: // IDE-managed Components TScrollBox *ScrollBox1; TLabel *Label1; private: // User declarations TWndMethod OldScrollBoxWndProc; void __fastcall ScrollBoxWndProc(TMessage& Message); public: // User declarations __fastcall TForm1(TComponent* Owner); }; [/code] Unit.cpp __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { OldScrollBoxWndProc = ScrollBox1->WindowProc; ScrollBox1->WindowProc = ScrollBoxWndProc; ScrollBox1->VertScrollBar->Range = 500; } void __fastcall TForm1::ScrollBoxWndProc(TMessage& Message) { switch (Message.Msg) { case WM_VSCROLL: { Label1->Caption = IntToStr(ScrollBox1->VertScrollBar->ScrollPos); } break; } OldScrollBoxWndProc(Message); } |
linly
一般會員 發表:42 回覆:37 積分:15 註冊:2007-10-07 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |