Search code examples
windowsuser-interfacec++11windowpaint.net

Windows GUI : attempting a Paint.net style pannel


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 :-)


Solution

  • 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.