Asked by:
[Win32 API] Resizing a borderless window?

Question
-
I was trying to implement a borderless window that can be scaled by handling WM_NCHITTEST message. This works now, but whenever I put another window in front, this "borderless" window gets a thick white border. The window style includes WS_THICKFRAME, which is required to make window resizable, and when the window is upfront does not impose any issues. Without WS_THICKFRAME, borderless windows will not get that white border when in the background, but I cannot do the resizing either.
This white border is acceptable if the window is actually a rectangle, but it makes sense to (and I was trying to ) use DwmEnableBlurBehind and make parts of the window transparent. It also makes sense to use SetWindowRgn to make the mouse able to pass through the window if transparent to select something behind the window. When combined, the white border loses its straight outline and turn into something like paint stain (thick line cropped by the the region border).
- Edited by shangjiaxuan Thursday, August 13, 2020 8:36 AM
- Moved by Jeanine ZhangMicrosoft contingent staff Tuesday, August 18, 2020 1:13 AM
Thursday, August 13, 2020 8:32 AM
All replies
-
Redrawing the window after leaving focus removed the border after leaving focus, but the same thing (when entering focus) cannot work if the focus starts by draging the window (the border shows again).Thursday, August 13, 2020 10:58 AM
-
I don't see what you mean by the "thick white border" and what you want to get...
For example, with DWM code from MSDN + SetWindowCompositionAttribute
for the blur effect, I get, with a window (Calc), behind or above =>
Thursday, August 13, 2020 7:15 PM -
I'm sorry but my account has not been verified yet, so I can't post the image or link to image yet. I was using client alpha blend to make window of any shape anti-aliased (e.g. round corner, concave, etc) (may look like just a widget on desktop, etc). The blurbehind can accept a blur region which you can put outside the client area, then the whole window will have your own direct alpha blend (the method for antialiasing).
The shape was for corners to make user able to click through to the underlying things (e.g. desktop)
Friday, August 14, 2020 7:43 AM -
The white border appears when the window goes into focus (before the WM_PAINT message) or gets out of focus (after the WM_ACTIVATE message).
This seems to happen when the window is borderless and has WS_THICKBORDER for resizing (via nchittest). Only being borderless will not have this issue
- Edited by shangjiaxuan Friday, August 14, 2020 8:15 AM
Friday, August 14, 2020 8:14 AM -
Friday, August 14, 2020 9:16 AM
-
Yes, I've been referencing this material. This border thing only happens if the click is on the dragable area. If the area is client area, there will not be any border shown.
Amateur in programming (University student, physics major)
Saturday, August 15, 2020 12:16 AM -
I just verified my account, so here are the screenshots.
When working normally (The window is ellipse shaped, transparent):
When the border appears and the region clips it:
Amateur in programming (University student, physics major)
Saturday, August 15, 2020 12:28 AM -
Hi,
Thank you for posting here.
According to the issue, it is more related to the winapi. I suggest you should ask it in Winapi-General forum for better help.
Best Regards,
Jeanine Zhang
"Visual c++" forum will be migrating to a new home on Microsoft Q&A !
We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A !
For more information, please refer to the sticky post.Monday, August 17, 2020 2:09 AM