Search code examples
c#windowswinformsdesktop-applicationsoftware-design

Is there any way to use WinForms to create a "dock"-like app that is able to open additional windows?


So, I am trying to work on an program that uses an interface similar to other programs like RocketDock, etc. When the program is running, it should appear as a vertical dock with not borders or anything. Inside the "dock" would be a collection of icons that each open a window besides the dock. Inside the window, different functions could be performed depending on the which icon was clicked. I'm thinking I can do something like this with WinForms, but I wanted to create something that is persistant on the desktop as long as the program is running. Would this be possible in WinForms? Is there a library or something that would help me out?

I made a quick sketch of what I'm talking about. I'm hoping this can help clarify what I mean.

example sketch

I don't really have much working right now. I'm still trying to figure out a starting point.


Solution

  • Check Spy++ https://learn.microsoft.com/en-us/visualstudio/debugger/introducing-spy-increment?view=vs-2019 to use as a tool to learn all the window styles on the product you use for inspiration.

    Check if using System.Windows.Forms.Form.CreateParams is enough to augment the window that will be created (override it in your derived Form class), for example:

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
    
        protected override CreateParams CreateParams
        {
            get
            {
                var r = base.CreateParams;
                r.ExStyle |= 0x88;
                return r;
            }
        }
    }
    
    

    see styles information here:

    Topic is so big that it will require you to do a lot of research to get to the result you need, but this should provide a good start.

    It is also worth noting that P/Invoke allows you to call almost any Win32 function to use Windows behavior that isn't available through .NET APIs.