0

I need to implement a GUI for a 3D modeling app. So far I have implemented a Windows Ribbon menu - now I need to add pannels to add controls to. The best I could find as a model so far are the Paint.net control pannels. So I'm looking for something that looks and behaves just like this.

Paint.net UI

Features I'm looking forward to mimic (all pictured above) :

  • Thin border
  • Pannel title
  • Small top-right close button
  • Thin window header
  • Conditionnal vertical slider
  • The pannels should always stay on top of main app window
  • The pannels should not stay on top of other apps in front of the main app window
  • The pannels/windows should not pop a new item in the windows task bar
  • Transparency on blur is optionnal
  • A small footer with buttons would be nice too

So far here is what I achieved (code below) :

App UI so far

This is a very basic windows - several problems are obvious :

  • The window layout is a standard app window layout (thick border + I don't like the rounded edges)
  • It has a title but no buttons in it's header
  • The vertical scroll bar doesn't hide if unnecessary
  • The window pops it's own icon in the Windows taskbar
  • The window stays on top of all windowed app, not just the app main window

The code so far :

// Model structure pannel
wndClass.lpszClassName = "StructurePannel";
if (!RegisterClassEx(&wndClass)) return -1;
g_WindowHandlePannelStructure = CreateWindowEx(
    WS_EX_TOPMOST,
    "StructurePannel",
    "Model Structure Pannel",
    WS_BORDER | WS_CAPTION | WS_OVERLAPPED | WS_POPUP | WS_SIZEBOX | WS_VSCROLL,
    CW_USEDEFAULT,
    CW_USEDEFAULT,
    300,
    550,
    NULL,
    NULL,
    hInstance,
    NULL);

I'm looking for someone to give me a thorough Paint.net style pannel example - or to point me to a good code example. I have downloaded the latest open sourced PDN source code but not sure where to start looking for the code responsible for this part of the UI. An educated direction is welcome too :-)

PinkTurtle
  • 6,942
  • 3
  • 25
  • 44
  • 1
    I believe you are looking for the `WS_EX_TOOLWINDOW` [extended window style](https://msdn.microsoft.com/en-us/library/windows/desktop/ff700543(v=vs.85).aspx). – melak47 Nov 26 '15 at 17:30
  • Hmm I'll check that and let you put this as answer if you are correct - later this evening. – PinkTurtle Nov 26 '15 at 18:02
  • I'm not sure if that will cover all of the features you want, but it should get you the look and be absent from the task bar. – melak47 Nov 26 '15 at 18:05
  • Yes this is what I was looking for! Thanks. If you put this as an answer I'll accept it. Cheers. – PinkTurtle Nov 26 '15 at 22:26

1 Answers1

1

Using CreateWindowEx(...) and the extended window style WS_EX_TOOLWINDOWshould get you the desired appearance of the window frame.

It will also take care of:

  • The pannels/windows should not pop a new item in the windows task bar

But I'm not sure if/how it will influence the "always on top"-ness.

melak47
  • 4,772
  • 2
  • 26
  • 37
  • "always on top"-ness is achieved by giving the pannel a parent window and `WS_CHILD` style. Now my pannel behaves exactly as I wanted :) Additionnaly, transparency can be set with the `WS_EX_LAYERED` (https://msdn.microsoft.com/en-us/library/windows/desktop/ms632599%28v=vs.85%29.aspx#layered) extended style and a call to `SetLayeredWindowAttributes(...)` (https://msdn.microsoft.com/en-us/library/windows/desktop/ms633540%28v=vs.85%29.aspx). – PinkTurtle Nov 27 '15 at 11:53
  • Correction : exact window template is : `WS_EX_TOOLWINDOW | WS_EX_LAYERED` as extended styles and `WS_CAPTION | WS_SIZEBOX | WS_SYSMENU` as styles. Allows the close button to display too. – PinkTurtle Nov 27 '15 at 19:50