473,411 Members | 2,059 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Form inheritance problems with anchored components


Hi,

I'm having a problem in Visual Studio in C#, using .NET Framework 1.1 Version
1.1.4322 and Microsoft Development Environment 2003 Version 7.1.3088

I make a form A and subclass it with form B. I place a protected component on
A and anchor it top,left,bottom,right.

If I change the size of form B, component G will resize with it
proportionally. But, when I recompile, the derived component G on form B will
"jump" resizing itself relative to its base class size.

For example, make a form A, size 300x300 and place a group box G on it, sized
200,200. Make G protected and anchor to top,left,bottom right. Now make a
subclass of form A called B.

B will have the G component on it of course. Set the size of form B to
400,400. Naturally G resizes with the form to 300,300. Now build the project
and "sproing!", component G resizes itself to 400,400 and is now over the
right and bottom edges of form B.

Now, reset B and G to their original values by hand in the Properties window.
Rebuild. Set form B to size 250,250. Group box G will resize to 150,150 of
course. Rebuild and "sproing!", component G resizes itself to 100,100.

Needless to say, this is extremely frustrating. I must leave all my subclassed
forms the exact same size as the base class or the components go haywire.
Subclass components placed inside base class components do not change size, so
they end up in wrong places and sizes within the base components, etc.

Has anyone else experienced this same issue. I cannot find anything about this
in the knowledge base. Maybe there is a fix for it, but I can't find it.

Thanks!

--
Junkguy
Nov 16 '05 #1
3 2414
Hi

I solve this problem with docking and always anchoring to top or left only.
For example, if I want to have a button in lower right corner anchored to
right I do the following:
Create a panel and dock it to the bottom, within it create a panle and dock
it to the right and on this panel put a button anchored to letf/top only.
Another workaround might be to create your controls with code.

And yes, it is frustrating.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"Junkguy" <ju*****@columbus.rr.com> wrote in message
news:ju***************************@news-server-fe-02.columbus.rr.com...

Hi,

I'm having a problem in Visual Studio in C#, using .NET Framework 1.1 Version 1.1.4322 and Microsoft Development Environment 2003 Version 7.1.3088

I make a form A and subclass it with form B. I place a protected component on A and anchor it top,left,bottom,right.

If I change the size of form B, component G will resize with it
proportionally. But, when I recompile, the derived component G on form B will "jump" resizing itself relative to its base class size.

For example, make a form A, size 300x300 and place a group box G on it, sized 200,200. Make G protected and anchor to top,left,bottom right. Now make a
subclass of form A called B.

B will have the G component on it of course. Set the size of form B to
400,400. Naturally G resizes with the form to 300,300. Now build the project and "sproing!", component G resizes itself to 400,400 and is now over the
right and bottom edges of form B.

Now, reset B and G to their original values by hand in the Properties window. Rebuild. Set form B to size 250,250. Group box G will resize to 150,150 of
course. Rebuild and "sproing!", component G resizes itself to 100,100.

Needless to say, this is extremely frustrating. I must leave all my subclassed forms the exact same size as the base class or the components go haywire.
Subclass components placed inside base class components do not change size, so they end up in wrong places and sizes within the base components, etc.

Has anyone else experienced this same issue. I cannot find anything about this in the knowledge base. Maybe there is a fix for it, but I can't find it.

Thanks!

--
Junkguy

Nov 16 '05 #2
In article <eQ**************@TK2MSFTNGP11.phx.gbl>,
"Miha Markic [MVP C#]" <miha at rthand com> wrote:
Hi

I solve this problem with docking and always anchoring to top or left only.
For example, if I want to have a button in lower right corner anchored to
right I do the following:
Create a panel and dock it to the bottom, within it create a panle and dock
it to the right and on this panel put a button anchored to letf/top only.
Another workaround might be to create your controls with code.

And yes, it is frustrating.


Yikes! Are you serious. There is no fix for this?

Thanks for your response though. I appreciate your imagination in this. God
knows you need imagination to deal with the crazy curve balls that Visual
Studio throws your way.

--
Junkguy
Nov 16 '05 #3
Yikes! Are you serious. There is no fix for this?
AFAIK not.
Thanks for your response though. I appreciate your imagination in this. God knows you need imagination to deal with the crazy curve balls that Visual
Studio throws your way.


There are not that many afterall, at least serious ones.

Miha
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Frnak McKenney | last post by:
I'm running into problems with VisualStudio.NET2003 and Windows Forms inheritance. It _feels_ like a bug, but it could just as well be a misunderstanding on my part regarding how the VS Designer...
1
by: Nathon Dalton | last post by:
I have created a project with a form called SetupBodyTemplate. I have created a second inherited form called Demographics which inherits from SetupBodyTemplate. I've created several of these...
13
by: Lorne Smith | last post by:
Hi, First, sorry for the crosspost, but it seemed appropriate... :) I've come accross what I consider to be a bug, but I don't know if it's already known or not. (VS .Net 2003 Pro - VB.Net) ...
5
by: Genojoe | last post by:
I am using code from Help with two exceptions. (1) I increased the number of sample rows from 3 to 20, and (2) I anchored the datagrid to bottom of form so that I can change the size of the grid by...
0
by: Mac via DotNetMonster.com | last post by:
I have a MDI parent form and the only control on it is a panel anchored to the left hand side. I have menu items on the MDI parent that show & hide this panel. Ideally I would like it to show by...
0
by: Terry Hancock | last post by:
I've been discussing PyProtocols with a a friend collaborating with me on a SF game project, about the benefits and design concept of "component architecture", and I'm a little confused by what...
2
by: Kay Schluehr | last post by:
The problem of unintended inheritance is typical for OO frameworks and can be explained as follows. Given a class Foo implemented by Alice and a derived class Bar of Foo implemented by Bob. Bar...
0
by: Netter | last post by:
I made a usercontrol, actually it is a calculator with lots of little buttons. I have the control on a form. When I view the form in the IDE (or when running) the control is larger then when...
0
by: RobKinney1 | last post by:
This is a repost of a question I had earlier, but had no reply. I will try to refine: We have some software out (C# 2.0 Framework) and all cosmetic items display fine on everyones computer......
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.