Solved

How to Disable user resizing of a form?

Posted on 2003-11-05
3
1,600 Views
Last Modified: 2007-12-19
I have an application that at one point, pops up a custom window that has GDI+ drawings on it, based on the content of the first window.  I'm trying to disable the ability of the user to resize and relocate this form in an attempt to eliminate events that would cause a redraw, but I can't find any property of a Windows form that would allow you to lock a window size and position.  Any ideas?  Thanks in advance.
0
Comment
Question by:AlexSilverman
[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 2

Accepted Solution

by:
smitty22 earned 250 total points
ID: 9689831
Set the FormBorderStyle property to one of the "Fixed" values.  That will disable resizing of the form.  I'm not sure how you can lock in its position.
0
 
LVL 6

Expert Comment

by:purpleblob
ID: 9690264
The obvious answer to this would the be to simply set the FormBorderStyle to None but ofcourse this removes the caption bar and borders. Is this what you are after ?

If you want to keep the borders and/or caption then you could set the FormBorderStyle to FixedDialog and set the MinimizeBox and MaximizeBox to False. Now you can still move the form but not resize. Now with stopping the form moving, obviously the Move event is no good as this is after the move has taken place.

You could override the WndProc and catch the WM_NCHITTEST (0x0084) but then you have to handle whether the caption button button(s) have been pressed etc.

Hope this helps
0
 

Author Comment

by:AlexSilverman
ID: 9692032
Thanks to both of you.  It turns out that I don't need to lock the window position, so points go to Smitty.  Congrats.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Convert Silverlight ERP To Angularjs,HTML5 3 107
I need help adding validation to my MVC.Net view 6 36
Selenium and Xpath 4 67
Trigger C# code inside the SQL Server 6 57
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

734 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