Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2006

Tip: Looking for answers? Try searching our database.

TextBox AutoScale in VS 2005 designer

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Agata Staniak - 25 Feb 2006 22:12 GMT
I've recently moved to VS 2005 and .NET Framework 2.0 (from VS .NET 2003 and
.NET Framework 1.1). And I have a trivial problem in designer:

1) I create a new project with default settings (C# Windows Application).
OK.
2) And on the main form I put a TextBox. I set its width to 100 pixels. OK
so far.
3) Now I change TextBox font to Courier New, 12pt, bold. OK.
4) I want to set the TextBox'es height to 24 pixels. And I can't. It sets
its height back to 26 pixels.
5) So I want to change the property called AutoSize. TextBox inherits such a
property from TextBoxBase. But it is TextBoxBase's property, not TextBox'es,
so the property window doesn't show it.
6) So I modify the code generated by designer, I add a line:

textbox.AutoSize = false;

and change height to 24. OK, it works for a while. But when designer makes
any changes to code, it removes the line above that I added and returns back
to 26 pixels.

Now what I can do is change the AutoSize property and Height somewhere else
in code, where designer won't mess up. But:

1) It's not optimal to change the control's size twice: once when it is
created with the size forced by designer, and then again change the size to
what I want it to be
2) When I change it in code I lose the possibility to view visually how the
final effect will be, because designer will show something different from
what will be set during runtime. I want to layout controls in designer. I
don't want to set all the sizes and positions at runtime in code without
preview, because it's too much work with over 30 controls. And if I can't do
it in designer, then VS 2005 is a useless tool. I can write code in notepad.
3) I had no such problem in .NET 1.1 and Visual Studio .NET 2003
4) I have no problem with other controls, such as Label, which has a
property AutoSize on its own (not inherited) and I can change that property
in designer's property window, and all works fine.

Any ideas how can I turn off TextBox'es AutoSize property in designer?

Thanks in advance,
Agata Staniak
Michael.Suarez@gmail.com - 27 Feb 2006 20:17 GMT
I noticed this too..
One workaround (though not ideal), is to set multiline = true... then
you can set height to whatever you want and it will stick.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.