Resizing a form in code
-
:confused:
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
-
:confused:
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
-
I'm trying to have a form that automatically saves it's size and state. I've got the state part down, but I now need the size part. If anyone has ideas for a form location part I'm open for ideas? Robust code would be nice :)
:confused: you already are saving and restoring the state, whatever that may be (visible, minimized, maximized, ... ?). But you ask about the size, which is just two numbers ? Whatever scheme you have choosen, add a couple of lines to it, two to write a number, and two to four to read and parse a number. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
-
:confused: you already are saving and restoring the state, whatever that may be (visible, minimized, maximized, ... ?). But you ask about the size, which is just two numbers ? Whatever scheme you have choosen, add a couple of lines to it, two to write a number, and two to four to read and parse a number. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
I get the following problem (probably because I didn't parse correctly): Expression is a value and therefore cannot be the target of an assignment. Is there a better way to do this:
Me.Size.Height = My.Settings.MainFormHeight ' I have a setting called MainFormHeight
-
I get the following problem (probably because I didn't parse correctly): Expression is a value and therefore cannot be the target of an assignment. Is there a better way to do this:
Me.Size.Height = My.Settings.MainFormHeight ' I have a setting called MainFormHeight
OK, now I see your problem. Form has Size property, and Size has a Height property, both have getters and setters; nevertheless you can not change a Form's height by doing Form.Size.Height=somevalue; instead you should create a new instance of Size with the right values in the constructor, then assign this to Form.Size :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
-
OK, now I see your problem. Form has Size property, and Size has a Height property, both have getters and setters; nevertheless you can not change a Form's height by doing Form.Size.Height=somevalue; instead you should create a new instance of Size with the right values in the constructor, then assign this to Form.Size :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
-
Sorry, I once more don't know what you mean by that. But probably yes.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
-
you should also be able to save the form size as a
size
value in settings as oppose to two seperate settings.Please check out my articles: The ANZAC's articles