Recent

Author Topic: Snap Layout for Borderstyle = bsNone  (Read 1884 times)

CCRDude

  • Hero Member
  • *****
  • Posts: 596
Snap Layout for Borderstyle = bsNone
« on: March 26, 2022, 11:27:41 am »
I've been working on getting certain apps to support Windows 11 better.

Out of the box forms work fine with rounded corners and snap layout.

Problem is I've got a custom UI (I know my own objections against that, but let's just say I gave in to a designers opinion this time), with a custom title bar.

This custom title bar is realized by simply setting BorderStyle := bsNone, using MouseDown, MouseMove, MouseUp for moving, manually calling the system menu, manually minimizing and closing.

Now BorderStyle = bsNone has no rounded corners by default, but thanks to this hint, rewritten as a class helper, that is a one-liner.

I've still got problems with snap layout though. I can't trigger it because I have no maximize button, which is fine, but I also can't pick my window when going through the layout through another app.

Microsoft Docs say to use WM_NCHITTEST , but this looks like it is just for triggering, not for telling the window manager to use this in a snap layout.

Problem 1: if I use WM_NCHITTEST  to react to minimize and close, MouseDown isn't triggered for them any more, but since they're on a control, if the system sends the corresponding message, then probably to the control instead of form.

Problem 2: snap layout still isn't available.

There's a bunch of threads here about bsNone layouts, mostly having to do with moving the window. WM_NCCALCSIZE and WM_GETMINMAXINFO didn't work for me yet for example.

Anyone had success with this?

CCRDude

  • Hero Member
  • *****
  • Posts: 596
Re: Snap Layout for Borderstyle = bsNone
« Reply #1 on: March 30, 2022, 05:37:43 pm »
I was able to get WM_NCCALCSIZE (on Windows) using the custom code here in this forum post.

This is working with a simple TForm, but not yet in my usage case - the code linked above is not quite working in all situations it seems.

 

TinyPortal © 2005-2018