Solved

Suppress form maximization on title double-click

Posted on 2010-11-18
3
311 Views
Last Modified: 2012-06-21
I'm using c# 4.0. I have a form that has a title bar. I want to suppress the ability to maximize the form by double clicking it.

I've tried

 
private void Form1_Load(object sender, EventArgs e) {
this.SetStyle(ControlStyles.StandardDoubleClick, false);
this.UpdateStyles();
}

Open in new window


but that doesn't do it. I've tried trapping the click event but don't know how to suppress it.

Ideas?
0
Comment
Question by:BlearyEye
3 Comments
 
LVL 28

Expert Comment

by:strickdd
ID: 34168152
Do you allow resizing of the window? If not, make sure you specify the max window size. If you do allow resizing, I don't think this can be changed.
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 34168304
Like this?
http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_24050566.html

Code:
public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }



        const int HTCAPTION = 0x2;

        const int WM_NCLBUTTONDBLCLK = 0xA3;



        protected override void WndProc(ref Message m)

        {

            switch (m.Msg)

            {

                case WM_NCLBUTTONDBLCLK:

                    if (m.WParam.ToInt32() == HTCAPTION)

                    {

                        return;

                    }

                    break;

            };

            base.WndProc(ref m);

        }



    }

Open in new window

0
 
LVL 1

Author Closing Comment

by:BlearyEye
ID: 34168976
Perfect, thanksl
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need to pass stored proc parameters in list 13 32
Why Does This Page Not Show Up? 4 21
scanning dentists xray (the small ones) 3 41
What .NET URL re-routing tool did I use? 2 31
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now