Solved

How to Disable user resizing of a form?

Posted on 2003-11-05
3
1,587 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
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now