By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,361 Members | 3,185 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,361 IT Pros & Developers. It's quick & easy.

Resize before Load?

P: n/a
Greetings!

I have a form with a listview, a menu, and a few text boxes, labels and
command buttons. I want to resize the listview when the form is resized to
that the widths of the spaces between the borders of the listview and the
borders of the form remain constant. I am finding this to be unexpectedly
hard. For one thing, I initialized some values in the form's Load event,
and I'm doing the control resizing in the form's Resize event. But I am
finding that the Resize event fires first! Actually, the Resize event fires
four times before the form's Load event! How can this be?

Thanks!

Rob, who obviously has some fundamental flaws in his understanding of event
sequences.
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
In article <ur**************@tk2msftngp13.phx.gbl>, th*****@n2net.net
says...
I have a form with a listview, a menu, and a few text boxes, labels and
command buttons. I want to resize the listview when the form is resized to
that the widths of the spaces between the borders of the listview and the
borders of the form remain constant. I am finding this to be unexpectedly
hard.


Instead of doing it with events, look into the Anchor and Dock
properties of your form.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 20 '05 #2

P: n/a
Patrick,

Thanks for the tip. I will look into those properties.

But could you please explain why I'm getting resizes before loads? I'm
afraid that if I don't understand that, I'm going to get bitten in
uncomfortable locations on repeated occasions.

Thanks!

Rob
Nov 20 '05 #3

P: n/a
Hi Rob,

You can open the design part of the code in a form by pushing on the + in
the code.
There you will see a lot of coding accoording *me.* that is the form, there
are as well settings that affects the size setting itself however as well
thinks as border which can be different, have a look at that, I hope you
will understand it than more?

When not, feel free to reply?

Cor
Nov 20 '05 #4

P: n/a
VJ
The resize event does fire before load, that is windows sequence of events,
its given. It fires 4 times.. that is interesting.. maybe your resize code
is causing it to do that..

if you want not to fire the resize, set a boolean variable make it false in
the form constructor, then set it to true after the Load event's last line
of code. Use this boolean to drive your code in resize.

Private Sub New()
{
blnVariable = false
Intialziecomponent()
..
}

Private sub Form1_Load(...)..
{
'Code starts here...

'Last Line of Code..
blnVariable = true
}

Private Sub Form1_Resize (... )..
{
if blnVariable then
'execute resize code.. here..
end if
}

VJ

"Rob Richardson" <th*****@n2net.net> wrote in message
news:ur**************@tk2msftngp13.phx.gbl...
Greetings!

I have a form with a listview, a menu, and a few text boxes, labels and
command buttons. I want to resize the listview when the form is resized to that the widths of the spaces between the borders of the listview and the
borders of the form remain constant. I am finding this to be unexpectedly
hard. For one thing, I initialized some values in the form's Load event,
and I'm doing the control resizing in the form's Resize event. But I am
finding that the Resize event fires first! Actually, the Resize event fires four times before the form's Load event! How can this be?

Thanks!

Rob, who obviously has some fundamental flaws in his understanding of event sequences.

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.