Suppress form maximization on title double-click

Posted on 2010-11-18
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);

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.

Question by:BlearyEye
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 28

Expert Comment

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.
LVL 86

Accepted Solution

Mike Tomlinson earned 500 total points
ID: 34168304
Like this?

public partial class Form1 : Form
        public Form1()

        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)
            base.WndProc(ref m);


Open in new window


Author Closing Comment

ID: 34168976
Perfect, thanksl

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

688 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