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

Form Positioning.

P: n/a
Hi,

I have a simple problem concerning the position of forms.

My windows form application has a main form and three instances of a
second form; BForm. It is not an MDI parent/child application and I've
set the StartPosition property for both forms to be Manual.

In the New method of the main form I create the 3 BForms and try to
position them below the main form (with the left sides aligned) using
the code below:

intPosX = 100 ' Same as the main form.
intPosY = Me.Top + Me.Height + (intBFormCounter*BForm.Height)
BForm.Location = New Point(intPosX, intPosY)

Note intBFormCounter is a zero based counter of the number of instances
of the BForm.

The three identical forms are correctly aligned and stacked but the
first (uppermost) has its title bar hidden below the lower edge of the
main form. This behaviour remains the same if I change the position of
the main form.

I think that I am not correctly determining the height or lower edge
position of the main form.

Can anyone see what I've missed?

Thanks in advance,

Andy

Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi,

You usually have to add a fudge factor when doing things like this.
Try adding 10 the y postion. Play around with it a little.

Ken
-----------------
"Andy" <an*********************@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Hi,

I have a simple problem concerning the position of forms.

My windows form application has a main form and three instances of a
second form; BForm. It is not an MDI parent/child application and I've
set the StartPosition property for both forms to be Manual.

In the New method of the main form I create the 3 BForms and try to
position them below the main form (with the left sides aligned) using
the code below:

intPosX = 100 ' Same as the main form.
intPosY = Me.Top + Me.Height + (intBFormCounter*BForm.Height)
BForm.Location = New Point(intPosX, intPosY)

Note intBFormCounter is a zero based counter of the number of instances
of the BForm.

The three identical forms are correctly aligned and stacked but the
first (uppermost) has its title bar hidden below the lower edge of the
main form. This behaviour remains the same if I change the position of
the main form.

I think that I am not correctly determining the height or lower edge
position of the main form.

Can anyone see what I've missed?

Thanks in advance,

Andy

Nov 21 '05 #2

P: n/a
Hi Ken,

Many thanks for the prompt response. A fudge factor of 19 worked for
me. I am a little surprised why this is necessary but I'm new to
VB.NET so perhaps its lack of experience ;)

Cheers,

Andy

Nov 21 '05 #3

P: n/a
You might look at the difference between the Form size and the
Form.ClientSize heights. Note the Clientsize is the size excluding the form
title bar and borders. You may need to add this offset
--
Dennis in Houston
"Andy" wrote:
Hi,

I have a simple problem concerning the position of forms.

My windows form application has a main form and three instances of a
second form; BForm. It is not an MDI parent/child application and I've
set the StartPosition property for both forms to be Manual.

In the New method of the main form I create the 3 BForms and try to
position them below the main form (with the left sides aligned) using
the code below:

intPosX = 100 ' Same as the main form.
intPosY = Me.Top + Me.Height + (intBFormCounter*BForm.Height)
BForm.Location = New Point(intPosX, intPosY)

Note intBFormCounter is a zero based counter of the number of instances
of the BForm.

The three identical forms are correctly aligned and stacked but the
first (uppermost) has its title bar hidden below the lower edge of the
main form. This behaviour remains the same if I change the position of
the main form.

I think that I am not correctly determining the height or lower edge
position of the main form.

Can anyone see what I've missed?

Thanks in advance,

Andy

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.