Responding to mouse-down messages |
尚未結案
|
max23
一般會員 發表:1 回覆:0 積分:0 註冊:2002-10-21 發送簡訊給我 |
Responding to mouse-down messages 我的元件必須隱藏繼承元件的MouseDown事件,並在我自已的MouseDown事件中
處理一些事,我在help裡找到下面的說明,不過我照它的方法還是有問題,請
問還有那邊有問題嗎????? A MouseDown method is a protected method for a controls OnMouseDown event.
The control itself calls MouseDown in response to a Windows mouse-down message.
When you override the inherited MouseDown method, you can include code that provides other responses in addition to calling the OnMouseDown event.
To override MouseDown, add the MouseDown method to the TDBCalendar class: class PACKAGE TDBCalendar : public TSampleCalendar {
...
protected:
virtual void __fastcall MouseDown(TMouseButton Button, TShiftState Shift, int X, int Y);
...
}; Write the MouseDown method in the .CPP file: void __fastcall TDBCalendar::MouseDown(TMouseButton Button, TShiftState Shift, int X, int Y) {
TMouseEvent MyMouseDown; // declare event type
if (!FReadOnly && FDataLink->Edit()) // if the field can be edited
TSampleCalendar::MouseDown(Button, Shift, X, Y); // call the inherited MouseDown
else
{
MyMouseDown = OnMouseDown; // assign OnMouseDown event
if (MyMouseDown != NULL) MyMouseDown(this, Button, // execute code in the...
Shift, X, Y); // ...OnMouseDown event handler }
} When MouseDown responds to a mouse-down message, the inherited MouseDown method is called only if the control ReadOnly property is false and the data link object is in edit mode, which means the field can be edited. If the field cannot be edited, the code the programmer put in the OnMouseDown event handler, if one exists, is executed.
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |