Audax321 Posted September 16, 2003 Posted September 16, 2003 Hello, I have a form that changes its minimum size when certain buttons are clicked. The code works fine when the form size is Normal. But, if the user accesses settings when the form is maximized and causes a change in the minimum size setting I need a way to alter the minimum size setting as well as subtract that amount from the actual size of the form when it is normal without exiting the maximized window state. Right now, when the form changes to the Normal window state, the form is too large. This is probably quite confusing.... so basically, what I need is to be able to adjust the normal form size while the form is maximized. Is this possible??? Thanks... Quote
Photovoltaic Posted September 16, 2003 Posted September 16, 2003 Me.Width = Me.MinimumSize.Width Me.Height = Me.MinimumSize.Height Quote
Audax321 Posted September 16, 2003 Author Posted September 16, 2003 I think you misunderstood me... let me try explaining it better. I have a button on my form that causes the form to expand a certain amount to the right to display an options menu, let's say from 200 to 350. This alters the minimumsize property to limit the size the user can resize the form to so the minimumsize.width property is now 350. Now, if the user used the buttom to expand the form from 200 to 350 and then maximizes the form, but while the form is maximized he again pushes the button to contract the options menu (hide it), the maximized window will accomadate the change by making the other controls fill the window without resizing the window itself. At the same time a sub will run to change the minimumsize.width property to 200. But, what happens now is that when the user changes the windowstate to normal again, by pushing the forms maximize button again, the normal sized window is the size it was when the options portion was open - 350. But, the options are no longer visible because they were hidden when the form was maximized. The result is an elongated form. Although I understand what the code you gave above means, I can not use it because the original size of the form before and after maximizing is not constant. The user can scale the size of the form to whatever he or she wishes. So I need to change the size of the normal size form, not the minimum allowed size of the form.... I hope this is a little clearer... its difficult to explain. Quote
AlexCode Posted September 17, 2003 Posted September 17, 2003 I got it... When you have the window expand and have the normal with in 350 when you click the button you want that when the window returns to its normal size, return with width 200 right? I tried thid code on the button click and it works fine.~ Mess around with it... Just please tell me if its what yoiu wanted... I like to know... Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Select Case Me.Width Case 200 Me.Width = 350 Case Is > 200 Me.Width = 200 End Select End Sub Quote Software bugs are impossible to detect by anybody except the end user.
elikakohen Posted September 18, 2003 Posted September 18, 2003 AlexCode, It may be a whole lot easier to use dockers... Here is a very simple example. Let me know if this works for you... I can modify this a little if you need.dockerexample.zip Quote
Audax321 Posted September 19, 2003 Author Posted September 19, 2003 Hello, I apologize its been a while since I've had a chance to come on here again. AlexCode your code is kind of like what I want, but the size is variable according to whatever the user sets it to so you can't really use Select Case. Anyway, I was able to fix the problem by just using boolean variables to determine if the form size was changed after the window was maximized and comparing the boolean variables to before the window was maximized. I was hoping there was a cleaner way to do this, but I haven't been able to find one. I can't imagine why MS wouldn't have differentiated the Height and Width properties of a form as MaximizedHeight, MaximizedWidth, NormalHeight, and NormalWidth or at least allowed access to these in some manner. elikahohen, I took a look at the example and liked it, but unfortunately can't use it. The idea of the docker program is to have a control grow "inward" as I have it growing "outward" to display it. The problem arises because of the initial portion of the window that is visible in my program. I would have to decrease the width of the control present in that initially visible portion of the window in order to show the new control, which I can't do. Another way around this would be to increase the minimium size of the window by however much the new portion of the window takes up and then show the docked control. However, this will cause the same problem I was having initially. But, all is not lost. I was making a small HTML editor to learn basic HTML for myself because Notepad is a pain to use to learn HTML. Anyway, the menu I have in that program would be a lot easier to use if I utilize docked controls... so I will look into that. Thanks for all your help :) Quote
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.