alexandernst
alexandernst

Reputation: 15089

Frameless window with min/max/close buttons (Windows)

On Mac there is a window flag/call: WindowTitleHidden + [nativeWindow setTitlebarAppearsTransparent:YES] which basically makes the title bar to be "embedded" inside the window itself instead of creating a frame that "holds" the window. Like this:

enter image description here

Notice how the minimize, maximize and close buttons are on the same row as the app's widgets.

Is there something similar for Windows?

Like this:

enter image description here

Code: https://github.com/alexandernst/TrueFramelessWindow

Upvotes: 1

Views: 694

Answers (1)

Dan Byström
Dan Byström

Reputation: 9244

AFAIK, you must draw them yourself and then reply to the WM_NCHITTEST mesage that Windows sends to your form to query where the mouse is positioned. That way you can tell Windows that the mouse is located over a, say, maximize button, although Windows itself didn't draw one there.

The painting can be done with the help of VisualStyleRenderer or ControlPaint.

I hope these questions will point you further:

Winforms: Add a close "x" button in a UserControl

Winforms - WM_NCHITEST message for click on control

Upvotes: 1

Related Questions