According to the Doc:
If the mouse is not captured, the message is sent to the window beneath the cursor. Otherwise, the message is sent to the window that has captured the mouse.
As far as I'm concerned, When the DOCK attribute of the panel is Fill, the message is sent to the panel window instead of the form window. So we couldn't resize the form after fill panel.
I suggest you could try to override OnSizeChanged of form and set the region of panel same size as form and then exclude its bottom right corner. This way, the excluded region doesn't belong to panel anymore and all messages including WM_NCHITTEST will be received by our WndProc; the panel even doesn't draw that region.
Here is my code:
protected:
void OnSizeChanged(EventArgs ^ e) override
{
region = gcnew System::Drawing::Region(System::Drawing::RectangleF(0, 0, this->Width, this->Height));
sizeGripRectangle = gcnew System::Drawing::RectangleF (this->Width - tolerance, this->Height - tolerance, tolerance, tolerance);
region->Exclude(*sizeGripRectangle);
this->panel1->Region = region;
this->Invalidate();
}
Best Regards,
Jeanine
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.