You can handle a click on the parent PageControl control. FI if the PageControl element is placed on the form, "MouseDown" forms will be called for this specified area. The reason is that PageControl returns an HTTRANSPARENT for test messages for this region, so mouse messages are routed to the control below it.
If this is not the case, you can change the way WM_NCHITTEST , for example, by subclassing a control or a derived control:
type TMyPageControl = class(TPageControl) protected procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST; end; procedure TMyPageControl.WMNCHitTest(var Message: TWMNCHitTest); begin inherited; if Message.Result = HTTRANSPARENT then Message.Result := HTCLIENT; end;
then the OnMouseDown control event will be fired. Of course, you can test the scope before changing the value of the returned message, this example should show how it will work.
source share