線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:888
推到 Plurk!
推到 Facebook!

使用 TPageControl

 
TATSU
版主


發表:50
回覆:135
積分:62
註冊:2003-01-16

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-09-02 20:02:27 IP:203.218.xxx.xxx 未訂閱
使用 TPageControl 時,雖然 TPageControl 提供兩個 events OnChanging 已經點選了一個 Tab 但要確定是否可以轉換 OnChange 已經轉換到另一個 Tab TPageControl 有一個 ActivePageIndex 存放正在使用的 Tab index ,但當點選另一個 Tab 時, OnChanging event 並沒有提供一個數字代表將要轉換的 tab。我最後將現存的 TPageControl 加建,各位看看有更好的方法嗎? unit MyPageControl; interface uses SysUtils, Classes, Controls, ComCtrls, Windows, Messages, Graphics; type TMyPageControl = class(TPageControl) private { Private declarations } FClickTabIndex : Integer ; protected { Protected declarations } procedure WMMouseOnTab(var Message : TWMMouse) ; message WM_LBUTTONDOWN ; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; function ClickTabIndex : Integer ; published { Published declarations } end; procedure Register; implementation procedure Register; begin RegisterComponents('Samples', [TMyPageControl]); end; constructor TMyPageControl.Create(AOwner: TComponent); begin inherited Create(AOwner); FClickTabIndex := -1 ; end; destructor TMyPageControl.Destroy; begin inherited Destroy; end; procedure TMyPageControl.WMMouseOnTab(var Message : TWMMouse) ; var x, y : Integer ; i : Integer ; Rect : TRect ; begin x := Message.XPos ; y := Message.YPos ; if PageCount > 0 then begin for i := 0 to (PageCount - 1) do begin if Pages[i].Enabled then begin Rect := TabRect(i) ; if (x >= Rect.Left) and (x <= Rect.Right) and (y >= Rect.Top) and (y <= Rect.Bottom) then begin FClickTabIndex := i ; break ; end; end; end; end else FClickTabIndex := -1 ; inherited ; end; function TMyPageControl.ClickTabIndex : Integer ; begin Result := FClickTabIndex ; end; end. ===================================================================
系統時間:2024-05-18 13:41:50
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!