471,325 Members | 1,381 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,325 software developers and data experts.

Problems with inheriting from a windows form

Hi,

I have a base form from which i want all of my forms to inherit from. The
base form has three buttons anchored to the bottom right of the base form.
When i first inherit a new form from the base form everything seems to be
fine. The 3 buttons from the base form show up on the bottom right of the
inherited form. But as i started adding new controls and building it i found
that the 3 buttons from the base form disappeared. When i expanded the
inheriting form and rebuilt it the 3 buttons showed up but in a wrong
location. And as i play around with resizing the inheriting form the 3
buttons seems to appear and disappear erratically. I rebuilt the solution
everytime. The same control location appear even when i run the app. I am
using VS.NET 2005. Has anybody encountered this problem before? Am i doing
anything wrong or miss anything or is it just a problem with the IDE? Any
help on this issue will be greatly appreciated.

Thank You,
Vish
Jan 30 '06 #1
7 4817
First of all, did you set the three buttons' Anchor property to "Bottom
Left"?

Jan 30 '06 #2
Hi,

Yes, I sure did set the anchor property of the 3 buttons to "Bottom Right".
When i inherit a new form it comes up alright. It is after i start adding
controls to it that the behaviour becomes erratic.

Thank you,
Vish

"Vish" wrote:
Hi,

I have a base form from which i want all of my forms to inherit from. The
base form has three buttons anchored to the bottom right of the base form.
When i first inherit a new form from the base form everything seems to be
fine. The 3 buttons from the base form show up on the bottom right of the
inherited form. But as i started adding new controls and building it i found
that the 3 buttons from the base form disappeared. When i expanded the
inheriting form and rebuilt it the 3 buttons showed up but in a wrong
location. And as i play around with resizing the inheriting form the 3
buttons seems to appear and disappear erratically. I rebuilt the solution
everytime. The same control location appear even when i run the app. I am
using VS.NET 2005. Has anybody encountered this problem before? Am i doing
anything wrong or miss anything or is it just a problem with the IDE? Any
help on this issue will be greatly appreciated.

Thank You,
Vish

Jan 30 '06 #3
Odd. I've never had that problem.

Are the buttons "private" in the parent form? Remember that even with
Anchor set to "Bottom Right", the child form still has to set the
Location properties of the buttons if you resize the child, and it
can't do that if the buttons are "private". Try setting the buttons'
visibility to "protected" on the parent form and see if that fixes the
problem.

Jan 30 '06 #4
Hi Bruce,

Seems like setting the modifiers to protected fixed the problem atleast for
the new inheriting forms. I greatly appreciate your help.

Thank You,
Vish

"Bruce Wood" wrote:
Odd. I've never had that problem.

Are the buttons "private" in the parent form? Remember that even with
Anchor set to "Bottom Right", the child form still has to set the
Location properties of the buttons if you resize the child, and it
can't do that if the buttons are "private". Try setting the buttons'
visibility to "protected" on the parent form and see if that fixes the
problem.

Jan 30 '06 #5
Glad you've got it sorted.

I would also suggest that unless you want to add other buttons in the same
row the proper way to do this is to put them in a panel and dock the panel
to the bottom - I SUSPECT that this would solve your problems without
requiring protected fields.

"Vish" <Vi**@discussions.microsoft.com> wrote in message
news:D8**********************************@microsof t.com...
Hi Bruce,

Seems like setting the modifiers to protected fixed the problem atleast
for
the new inheriting forms. I greatly appreciate your help.

Thank You,
Vish

"Bruce Wood" wrote:
Odd. I've never had that problem.

Are the buttons "private" in the parent form? Remember that even with
Anchor set to "Bottom Right", the child form still has to set the
Location properties of the buttons if you resize the child, and it
can't do that if the buttons are "private". Try setting the buttons'
visibility to "protected" on the parent form and see if that fixes the
problem.

Jan 31 '06 #6
Yes, it would. That's a better solution, I agree.

Docked objects don't need to be protected in the parent, since the
child never needs to modify their location or size. Objects placed
directly on the parent form that are Anchored other than Top Right need
to be protected, because the child form needs to modify at least their
Location, if not their Size, as it is resized.

Jan 31 '06 #7
Thanks for the suggestion guys. I would like the buttons to be private since
the inheriting forms should not modify the buuton property. Panel seems to be
be a good way to go. I wanted to get your thoughts on using a
toolstripcontainer instead of a panel. Do you think it is appropriate or is
it overkill? I do anticipate adding another dropdownbutton to the "Bottom
Left" for "Options" like printing etc.

-Vish
"Bruce Wood" wrote:
Yes, it would. That's a better solution, I agree.

Docked objects don't need to be protected in the parent, since the
child never needs to modify their location or size. Objects placed
directly on the parent form that are Anchored other than Top Right need
to be protected, because the child form needs to modify at least their
Location, if not their Size, as it is resized.

Jan 31 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Rasmus Kromann-Larsen | last post: by
2 posts views Thread by Darryn Ross | last post: by
4 posts views Thread by Michael C# | last post: by
5 posts views Thread by Ed Willis | last post: by
3 posts views Thread by Roy Soltoff | last post: by
reply views Thread by spam | last post: by
1 post views Thread by =?Utf-8?B?a2Fu?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.