关于Calendar的弱智问题 (100分)

  • 主题发起人 主题发起人 Rannce
  • 开始时间 开始时间
R

Rannce

Unregistered / Unconfirmed
GUEST, unregistred user!
小弟想在自己的Edit里下拉日历,继承了TMonthCalendar做个一个TPopupMonthCalendar,也能够工作,但是年的编辑框也死也不出来,鼠标点击MCHT_TITLEYEAR,并不出现那个UpDown编辑框,顶多闪一下,请各位大虾指点一下....


TPopupMonthCalendar = class(TMonthCalendar)
protected
procedure CreateParams(var Params: TCreateParams); override;
procedure CreateWnd; override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
end;
...
procedure TPopupMonthCalendar.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
with Params do
begin
Style := Style or WS_BORDER;
ExStyle := WS_EX_TOOLWINDOW or WS_EX_TOPMOST;
WindowClass.Style := CS_SAVEBITS;
end;
end;

procedure TPopupMonthCalendar.CreateWnd;
begin
inherited CreateWnd;
Windows.SetParent(Handle, 0);
CallWindowProc(DefWndProc, Handle, wm_SetFocus, 0, 0);
end;

procedure TPopupMonthCalendar.MouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer);
var MCHInfo:TMCHitTestInfo;
begin
inherited MouseUp(Button, Shift, X, Y);
MCHInfo.cbSize := SizeOf(TMCHitTestInfo);
MCHInfo.pt.x := X;
MCHInfo.pt.y := Y;
MonthCal_HitTest(Handle,MCHInfo);
if ((MCHInfo.uHit and MCHT_CALENDARDATE) > 0)
and(MCHInfo.uHit <> MCHT_CALENDARDAY)
and (MCHInfo.uHit <> MCHT_TITLEBTNNEXT)
and (MCHInfo.uHit <> MCHT_TITLEBTNPREV)
and (MCHInfo.uHit <> MCHT_TITLEYEAR){add by rannce} then
TDBGridInPlaceEdit(Owner).CloseUp(True)
else if (MCHInfo.uHit and MCHT_NOWHERE > 0) then
TDBGridInPlaceEdit(Owner).CloseUp(False)
else if not ((X >= 0) and (Y >= 0) and
(X < Width) and (Y < Height)) then
TDBGridInPlaceEdit(Owner).CloseUp(False);
end;
 
呵呵,看看rxlib的例子,很标准的。
 
接受答案了.
 
后退
顶部