2

I don't like how the native sizing border looks like :

See the blue border ?

I would like to have something like this fancy purple border instead : enter image description here

Should I implement my own sizing border manually or should I keep using the WS_THICKFRAME window style and customize it ?

And if I can customize it, I'd like it to be done without nasty hacks too...

user2018626
  • 83
  • 2
  • 7
  • The purple part in your screenshot is not part of the border. It is a [Status Bar](http://msdn.microsoft.com/en-us/library/windows/desktop/bb760726.aspx). Customizing the non-client area (which the border is a part of) is different from customizing the client area. – IInspectable Oct 19 '13 at 19:38
  • See http://stackoverflow.com/questions/19106047/winapi-c-reprogramming-window-resize I think it's hard. You can actually see the backgroud pixels behind The Visual Studio Express 2012 Main Window when you resize it by the left. I don't like it at all, your mileage may vary. – manuell Oct 20 '13 at 15:29

2 Answers2

1

You may create a window without border and caption bar by specifying the WS_POPUP flag in the window type flags.

Your handler of the WM_NCHITTEST message you must check which part of your window a certain pixel really belongs to (e.g. resinzing frame) and return the code for that part.

The drawback: You'll have to draw the entire window content (including caption etc.) your own.

Martin Rosenau
  • 17,897
  • 3
  • 19
  • 38
0

I think you should implement your own redraw procedure (for example to draw a purple rectangle at the bottom, and then draw an icon in the corner). If you're wanted to make your window similar to VS2013 window, then you should use WS_POPUP style and then implement your own redraw routine. If you wanted to customize your window's form you can use regions (SetWindowRgn(), CreateRectRgn(), CreateRoundRectRgn(), CreateEllipticRgn(), CreatePolygonRgn(), etc.) Broadly speaking, using WinAPI you can do everything, but are you limited to WinAPI only? It is good idea to use MFC or Windows Forms to make window interface creation much easier.

Netherwire
  • 2,669
  • 3
  • 31
  • 54
  • Maybe I should've been more specific. I already know how to draw the custom window itself and implement WM_PAINT. The WS_THICKWINDOW style seems very useful and responsive. And since it's the native sizing border I believe it's bug free too, that's why I'd like to keep it that way. However the native look and feel is really not that good for my window. If anyone has a full example of a custom sizing border I'd be grateful. – user2018626 Oct 19 '13 at 18:11
  • @user2018626 again: are you limited to WinAPI? – Netherwire Oct 19 '13 at 18:15
  • Technically, yes. But if MFC could make my life easier, I'll give it a try. – user2018626 Oct 19 '13 at 18:20
  • 1
    If your application is not an MFC application you cannot easily mix in MFC. You cannot, for example, use MFC just for window creation without also implementing a `CWinApp`-derived class. If you need a library to make window handling easier, use WTL for example. If you can and want to use a 3rd-party library. – IInspectable Oct 19 '13 at 19:41
  • @user2018626 in MFC you can easily create borderless window, add the resize picture at the corner, and handle MOUSE_DOWN event. When it happens, just resize your window based on its absolute position and current cursor position. – Netherwire Oct 19 '13 at 20:15