473,386 Members | 1,699 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,386 software developers and data experts.

Derived Forms resizing in dotnet. (Fix)

Derived Forms resizing in dotnet. (Fix)

Problem:

If you have a form base class:

public frmBase : System.Windows.Forms
{
public frmBase {
// DefaultFormFont is new Font("Tahoma", 10);
this.font = SomeOtherClassFullofConstants.DefaultFormFont;
}

....
}

But the designer shows the font as MS Sans Serif, 8.25ft (The default
value).

Then you create a derived form

public class frmDerived : frmBase { }

But in the designer, you choose the font to be Tahoma 10.

Unexpected:
On each subsequent build, the frmDerived form will grow in size
linearly, that includes bigger controls, larger form size, and greater
spacing. It only takes 5 or 6 builds before things get very large. But
only if it is open in the designer view (I think, not sure).

Unexpected#2:
If you change
public class frmDerived : frmBase { }
to
public class frmDerived : Forms { }

Then it will shrink back, but only if it just enlarged, very funky.

Solution

Make the font the same in the designer of both frmBase and frmDerived.
That means remove it from the constructor.

From some other Google messages, it also looks like you should do:

using SomeNameSpace.Base;
//…
public class frmDerived : frmBase

and NOT

// BADC0DE
public class frmDerived : SomeNameSpace.Base.frmBase
// BADC0DE

Not sure why, looks like voodoo, but it could be worse...

--
Tony
Stratton

P.S. This took me awhile to figure out, hopefully you can benefit from
my time. Well, my companies time...

P.P.S (..."bigger" controls, "larger" form size, and "greater"...) I
used three synonyms to enhance Google search-ability. I wish that the
MotherShip (MS) would do this with their MSDN search.
Jul 21 '05 #1
0 1124

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

Similar topics

10
by: William Stacey | last post by:
I know the following is not allowed, but shouldn't it be? sharedObject is part of Derived and should be able to be set in the constructor - no? tia public abstract class Base1 { protected...
12
by: Søren Reinke | last post by:
Hi there I have a little problem. How do i make sure that a graph is not redrawn while the form with the graph is being resized ? I have tried to add a mouse up/down event handler on the...
1
by: techfuzz | last post by:
I'm posting my problem experience and solution I found here for other ASP.NET developers. I have a web application that uses Forms Authentication with Active Directory to control access. In...
2
by: active | last post by:
Problem: The PictureBox display appears to have the image cut off. I.e., the image bottom does not display although the PictureBox has room for it. It occurred to me that what was displayed was...
8
by: Spam Trap | last post by:
I am getting strange resizing problems when using an inherited form. Controls are moving themselves seemingly randomly, but reproducibly. "frmBase" is my base class (a windows form), and...
1
by: Andrew Hayward | last post by:
I have a custom form, with all borders, title bar, etc. being drawn internally. Native borders and so on have been disabled. Because of this, however, resizing is a bit of a problem, and generally...
7
by: Graham Blandford | last post by:
OK, having answered my questions in a previous feed about pulling my derived class into the IDE.... Here's a new problem that I'm hoping can be fixed and isn't a .NET bug.... I have created an...
2
by: Dennis | last post by:
I have a form on which I have two controls, one docked to the left and the other docked to the right in a window that is Maximized. I developed the application on one computer which has a screen...
0
by: Tony | last post by:
Derived Forms resizing in dotnet. (Fix) Problem: If you have a form base class: public frmBase : System.Windows.Forms { public frmBase { // DefaultFormFont is new Font("Tahoma", 10);
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.