1

[C#]

I created a form without the title bar, like this: http://puu.sh/4421C.jpg.

That's my code:

    protected override CreateParams CreateParams
{
    get
    {
         CreateParams cp = base.CreateParams;
         cp.Style &= ~0xc00000;
         return cp;
    }
}

However, users can still drag around the form to resize it. How can I disable it, not just by code, but not even show the mouse that they can resize it? Thanks!

  • forgot which but: click your form, display properties, and look for resizeable, or there was also something about the type of form 3d/flat ..dont remember but it's there :) – Robert Hoffmann Aug 17 '13 at 16:53
  • Little google .. http://stackoverflow.com/questions/5416380/how-do-i-disable-form-resizing-for-users-in-c-sharp-winforms – Robert Hoffmann Aug 17 '13 at 16:54

1 Answers1

0

Is this what you mean(create a new winforms project and add this code to test if its what you needed):

        public Form1()
        {
            InitializeComponent();

            this.Text = string.Empty;
            this.ControlBox = false;
        }

        protected override void WndProc(ref Message m)
        {
            const int WM_NCHITTEST = 0x0084;

            if (m.Msg == WM_NCHITTEST)
                return;

            base.WndProc(ref m);
        }
terrybozzio
  • 4,424
  • 1
  • 19
  • 25