[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Suppress form maximization on title double-click

Posted on 2010-11-18
3
Medium Priority
?
324 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
[X]
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
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 86

Accepted Solution

by:
Mike Tomlinson earned 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

656 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