my code is in Form load event. basically what I am doing is that loading
form state from registry. if there is no saved information then it will
default to center of the screen. It does work after Init function (as Belee
suggested) but i want it to function in load event. I can go for location
settings but StartPosition makes things way easy as I do not have to worry
about resolution/screen calculation on client machine.
adition to that what is the reason behind StartPosition not working in any
other place other than in ctor?
Thanks.
"Derrick" <de***********@hotmail.com> wrote in message
news:rM*******************@news20.bellglobal.com.. .
Where are you setting it "at runtime"? I would say that anywhere other
than the constructor would not work, since by that time the form has
already "started". You'd probably have to change forms Location property,
instead of StartPosition.
"Pohihihi" <po******@hotmail.com> wrote in message
news:e2**************@TK2MSFTNGP11.phx.gbl... Actually I should have said that it do work using properties but it do
not work if I try to set that at run time.
"Belee" <Be***@discussions.microsoft.com> wrote in message
news:F8**********************************@microsof t.com... This property can be set in the properties window. Note that, the
properties
you set in the properties window does not appear anywhere apart from the
initialize components method which is called from the constructor. With
this
in mind, you have to put you code in the constructor after the following
line
of code:
InitializeComponent();
good luck!
Belee
"Pohihihi" wrote:
This one is really stupid Q but I am little not sure why my following
code
is doing nothing in load event of form.
this.StartPosition = FormStartPosition.CenterScreen
Rather starting form in center it just opens as default (and that is
where
ever)
any pointers?