• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1622
  • Last Modified:

How to Disable user resizing of a form?

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
AlexSilverman
Asked:
AlexSilverman
1 Solution
 
smitty22Commented:
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
 
purpleblobCommented:
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
 
AlexSilvermanAuthor Commented:
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now