There are two panels. Panel B is embedded in Panel A. How to redirect WM_NCHITTEST from B so that Panel A would process this message. It is supposed to make panel B as a splitter. That is, when you hover the mouse cursor on it, a cursor appeared as if you were resizing and you could change the size of panel A. I use Delphi 7
Here is the handler for A
procedure TPanelEx.WMNCHitTest(var Msg: TWMNCHitTest); var zScreenPt: TPoint; zOwnerPt: TPoint; begin inherited; if not (csDesigning in ComponentState) then begin if not Assigned(Parent) then Exit; zScreenPt := ScreenToClient(Point(Msg.Xpos, Msg.Ypos)); zOwnerPt := TControl(Parent).ScreenToClient(Point(Msg.Xpos, Msg.Ypos)); if (zScreenPt.y >= Height - BevelWidth) and (zOwnerPt.y < TControl(Parent).Height - BevelWidth - 1) then Msg.Result := HTBOTTOM end; end;
Panel B is created like this
constructor TPanelEx.Create(aOwner: TComponent); begin inherited; FShiftingPanel := nil; OnCanResize := OnCanPanelResize; BevelWidth := 2; Ctl3D := false; FPrevPanel := nil; FBottomPanel := TsPanel.Create(Self); FBottomPanel.Parent := Self; FBottomPanel.Height := 16; FBottomPanel.Align := alBottom; FBottomPanel.OnMouseEnter := OnMouseEnter; FBottomPanel.OnMouseLeave := OnMouseLeave; end;