?
Solved

How to Disable user resizing of a form?

Posted on 2003-11-05
3
Medium Priority
?
1,610 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 750 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

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…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month10 days, 1 hour left to enroll

762 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