amir100 Posted August 24, 2004 Posted August 24, 2004 Dear fellow vb .net programmers, I need to know something. You see, I want to make a windows form with a fixed size. Here's the things I've did: 1. Setting the "FormBorderStyle" property to "FixedSingle". 2. Setting the "MaximizeBox" property to "False". I believe by doing those two things above, I can make the user unable to resize the windows form that I made. But ... you see ... double clicking the title bar of a windows form does the same thing as clicking a maximizeBox. For this issue, I can't find anything to handle it. I can't even find the event that triggers when you double click a title bar. I really need a hand here. At the very least, thank you for all of your attention. Quote Amir Syafrudin
ToniMontana Posted August 24, 2004 Posted August 24, 2004 Hi, I have tried the same with my VS.net in C# and cannot see that the windows is maximizing after double-clicking the title-bar. So, what is the problem? Quote Greetings, Toni.
Joe Mamma Posted August 24, 2004 Posted August 24, 2004 1. Setting the "FormBorderStyle" property to "FixedSingle". 2. Setting the "MaximizeBox" property to "False". are you setting these via code? or in the IDE property editor? if in code. . . when? Quote Joe Mamma Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized. Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.
Arch4ngel Posted August 24, 2004 Posted August 24, 2004 I've done the same thing as you. Set FixedSingle and disabled the Maximized box via code and via IDE. Both didn't allow me to maximize my form. Make sure you don't touch those property elsewhere. Quote "If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown "Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me "A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend. C# TO VB TRANSLATOR
*Experts* DiverDan Posted August 25, 2004 *Experts* Posted August 25, 2004 Have you tried setting the MaximumSize and MinimumSize to the same values as the Form's Size? This will not allow the form to be re-sized at runtime. Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
amir100 Posted August 25, 2004 Author Posted August 25, 2004 Replying ... Ahem ... Yes, I did set those properties from the Properties Window (IDE). So I don't think I needed to set those properties again via code. But I haven't tried setting the MaximumSize and MinimumSize like DiverDan suggested. I guess I'll have a try. Thx all. Quote Amir Syafrudin
amir100 Posted August 31, 2004 Author Posted August 31, 2004 (edited) :( MaximumSize and MinimumSize ... tried ... failed ... ~sigh :). Everytime I double click the title bar of my form at running time, it always gets maximized. - I've set the FormBorderStyle to FixedSingle. - I've disable the control box so there shouldn't be any minimize, maximize, and close box. - I've set the maximumSize and minimumSize equals to the Size of the form. Yet my form still gets maximized when I double click it's title bar. Anyone can help? If there's a straight forward way to handle this, I'm thinking on handling the SizeChanged event of that form. Any suggestion? Thx. Edited August 31, 2004 by amir100 Quote Amir Syafrudin
*Experts* DiverDan Posted August 31, 2004 *Experts* Posted August 31, 2004 (edited) In designer mode, I set the MaximumSize and MinimumSize to the same size as the form's size. Double clicking the title bar moves the form to the upper left hand corner but does not resize the form. How can it??? Also, keep your form's FormBorderStyle as Sizeable. Then set both the MaximizeBox and MinimizeBox properities to False. This will even eliminate the form from moving to the upper left hand corner. Edited August 31, 2004 by DiverDan Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
amir100 Posted August 31, 2004 Author Posted August 31, 2004 In designer mode' date=' I set the MaximumSize and MinimumSize to the same size as the form's size. Double clicking the title bar moves the form to the upper left hand corner but does not resize the form. How can it??? Also, keep your form's FormBorderStyle as Sizeable. Then set both the MaximizeBox and MinimizeBox properities to False. This will even eliminate the form from moving to the upper left hand corner.[/quote'] It's like ... been there ... done that (it's on my previous post). I've done all the things you suggested, except for setting the FormBorderStyle to Sizeable. But still ... when I double-clicked the title bar, the form gets maximized. Btw, I'm setting the FormBorderStyle to FixedSingle also to prevent the form being resized. ~needToLearnMoreAboutSettingFormLayout ~fixedLayoutCanSometimesGivesMeAPainInTheHead Quote Amir Syafrudin
Arch4ngel Posted August 31, 2004 Posted August 31, 2004 Your problem is weird. You must have code that change things in your form property. To make a quick check... start a new solution (Windows App - not ASP.NET ) and do what was said before. If it don't work... well... maybe you shall continue trying but... start a new project without adding anything. Only a blank form Quote "If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown "Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me "A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend. C# TO VB TRANSLATOR
mekilla Posted September 1, 2004 Posted September 1, 2004 If all else fails just override the form's base onresize event and reset the size. Quote
Joe Mamma Posted September 1, 2004 Posted September 1, 2004 If all else fails just override the form's base onresize event and reset the size. have you tried playing with the FormBorderStyle property? Quote Joe Mamma Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized. Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.
amir100 Posted September 1, 2004 Author Posted September 1, 2004 Re: ... Well, thx all for replying. To sum it up. Here's what I've tried. 1. Setting the maximumSize and minimumSize to the same value as the Size. 2. Setting the MaximizeBox to False. I've even tried setting the ControlBox property to False. 3. Setting the FormBorderStyle to FixedSingle. All that inside the designer. What I haven't tried. 1. Doing all those things above via code. 2. Setting the FormBorderStyle to Sizeable. 3. Overiding the OnResize and SizeChanged event of the form. I think overiding is the best choice. Thx again. Quote Amir Syafrudin
Joe Mamma Posted September 1, 2004 Posted September 1, 2004 Well, thx all for replying. To sum it up. Here's what I've tried. 1. Setting the maximumSize and minimumSize to the same value as the Size. 2. Setting the MaximizeBox to False. I've even tried setting the ControlBox property to False. 3. Setting the FormBorderStyle to FixedSingle. All that inside the designer. What I haven't tried. 1. Doing all those things above via code. 2. Setting the FormBorderStyle to Sizeable. 3. Overiding the OnResize and SizeChanged event of the form. I think overiding is the best choice. Thx again. I see what you mean. and setting the Min/Max size keeps the form the right size, but it bounces the form around. . . and the form has to be non-modal? let me check out how delphi 7 did it when I get to work. I bet you will need to trap a window message. Quote Joe Mamma Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized. Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.
samsmithnz Posted September 1, 2004 Posted September 1, 2004 Have you tried starting a new project yet like Archangle said? With all your playing around you may have changed another property you hadn't thought of yet... Quote Thanks Sam http://www.samsmith.co.nz
Joe Mamma Posted September 1, 2004 Posted September 1, 2004 This looks like a weird behaviour quirk in .NET. Running Delphi (not .NET) setting the BorderStyle to any sizable style will apply WS_THICKFRAME to the Window Style used to create the handle. ( You just gotta luv Delphi !!!!) It appears this isn't being applied in any of the Border styles applied in .NET framework. Is this by design? or an oversight? Quote Joe Mamma Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized. Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.
*Gurus* divil Posted September 6, 2004 *Gurus* Posted September 6, 2004 Set the MaximizeBox property to false. This will stop the user maximizing the form in any way. This includes double-clicking the titlebar. I know you said you've tried it, but try it again now in a fresh project. That's the only property you have to set. If it doesn't work, there's something very wrong with your system or .net installation. Maybe you have some weird third-party software installed (WindowBlinds or something) that is overriding your UI. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.