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

Resizing textboxes

Hi All

I have written some code to rescale my windows forms application forms
depending on the users screen resolution
The application is designed for 1024 x 768 but some customers have 19"
screens and want to use 1280 x 1024 etc

I am using vb.net 2005

Code sample............................................ ..................
Dim x As Decimal = My.Computer.Screen.Bounds.Width / 1024

Dim y As Decimal = My.Computer.Screen.Bounds.Height / 768

Dim mysizef As New SizeF(x, y)

frm.Scale(mysizef)

.................................................. .................................................. .............

This works great for all controls except textboxes

Can someone advise me how to proportion the textboxes to match the other
controls e.g buttons, datagridviews etc

If I resize the font then it affects all the controls and the result is
overlapping controls etc

Regards

Steve
Sep 18 '07 #1
8 8427
Does setting the Multiline property of your textboxes to True accomplish what
you want?

"Steve" wrote:
Hi All

I have written some code to rescale my windows forms application forms
depending on the users screen resolution
The application is designed for 1024 x 768 but some customers have 19"
screens and want to use 1280 x 1024 etc

I am using vb.net 2005

Code sample............................................ ..................
Dim x As Decimal = My.Computer.Screen.Bounds.Width / 1024

Dim y As Decimal = My.Computer.Screen.Bounds.Height / 768

Dim mysizef As New SizeF(x, y)

frm.Scale(mysizef)

.................................................. .................................................. .............

This works great for all controls except textboxes

Can someone advise me how to proportion the textboxes to match the other
controls e.g buttons, datagridviews etc

If I resize the font then it affects all the controls and the result is
overlapping controls etc

Regards

Steve
Sep 18 '07 #2
Hi Steve,
This works great for all controls except textboxes
Do you mean that the height of the TextBox does not scale properly?

I performed a test and saw that the width of the TextBox is scaled
properly. As for the height of the TextBox, it doesn't change. This is
because the AutoSize property of the TextBox is set to true.

If you set the AutoSize property of the TextBox to false and then scale the
form, the height of the TextBox should be scaled properly.

Hope this helps.

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 18 '07 #3
Hi Linda

There is no Autosize property for textboxes

Regards
Steve

"Linda Liu [MSFT]" <v-****@online.microsoft.comwrote in message
news:Zz***************@TK2MSFTNGHUB02.phx.gbl...
Hi Steve,
>This works great for all controls except textboxes

Do you mean that the height of the TextBox does not scale properly?

I performed a test and saw that the width of the TextBox is scaled
properly. As for the height of the TextBox, it doesn't change. This is
because the AutoSize property of the TextBox is set to true.

If you set the AutoSize property of the TextBox to false and then scale
the
form, the height of the TextBox should be scaled properly.

Hope this helps.

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.

Sep 18 '07 #4
Hi Steve,

Thank you for your reply!
There is no Autosize property for textboxes
Sorry that I didn't clarify it clearly in my first reply. The TextBoxBase
class has a AutoSize property, which gets or sets a value indicating
whether the height of the control automatically adjusts when the font
assigned to the control is changed. As we all know, the TextBox class is
inherited from the TextBoxBase class, so TextBox inherits the AutoSize
property as well.

Although the AutoSize property of a TextBox is not available in the
Properties window, we can still use this property in code.

Hope this helps.
If you have anything unclear, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

Sep 19 '07 #5
Steve,

In my opinion is that very old method you use from the days far behind us.

What you call a 19" screen is something not existing anymore. In the
previous millenium a screen had always the same proportions between height
and width, that is no more in this millenium. So this way will probably keep
you in a way working your program will never fit.

Have a look at anchor and dock properties, when needed you can add extra
panels.

Just my opinion.

Cor

"Steve" <ga*****@nospam.nospamschreef in bericht
news:e4****************@TK2MSFTNGP02.phx.gbl...
Hi All

I have written some code to rescale my windows forms application forms
depending on the users screen resolution
The application is designed for 1024 x 768 but some customers have 19"
screens and want to use 1280 x 1024 etc

I am using vb.net 2005

Code sample............................................ ..................
Dim x As Decimal = My.Computer.Screen.Bounds.Width / 1024

Dim y As Decimal = My.Computer.Screen.Bounds.Height / 768

Dim mysizef As New SizeF(x, y)

frm.Scale(mysizef)

.................................................. .................................................. ............

This works great for all controls except textboxes

Can someone advise me how to proportion the textboxes to match the other
controls e.g buttons, datagridviews etc

If I resize the font then it affects all the controls and the result is
overlapping controls etc

Regards

Steve

Sep 19 '07 #6
Hi Linda

For the life of me I can't find how to do this

There is no Autosize property in intellisense in the code editor.

Can you advise me how to reference the autosize property for existing
textboxes on my windows forms

Regards
Steve

"Linda Liu [MSFT]" <v-****@online.microsoft.comwrote in message
news:6l****************@TK2MSFTNGHUB02.phx.gbl...
Hi Steve,

Thank you for your reply!
>There is no Autosize property for textboxes

Sorry that I didn't clarify it clearly in my first reply. The TextBoxBase
class has a AutoSize property, which gets or sets a value indicating
whether the height of the control automatically adjusts when the font
assigned to the control is changed. As we all know, the TextBox class is
inherited from the TextBoxBase class, so TextBox inherits the AutoSize
property as well.

Although the AutoSize property of a TextBox is not available in the
Properties window, we can still use this property in code.

Hope this helps.
If you have anything unclear, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

Sep 20 '07 #7
Hi Steve,

Thank you for your reply!

You're right that the AutoSize property of a TextBox is not available in
IntelliSense in the code editor. But you can type the line of code, such as
"TextBox1.AutoSize = False" in the code editor directly. When you build the
project, there won't be any compilation error.

Hope this helps.

Sincerely,
Linda Liu
Microsoft Online Community Support

Sep 20 '07 #8
Linda

Thank you. You learn something every day

regards
steve

"Linda Liu [MSFT]" <v-****@online.microsoft.comwrote in message
news:I9****************@TK2MSFTNGHUB02.phx.gbl...
Hi Steve,

Thank you for your reply!

You're right that the AutoSize property of a TextBox is not available in
IntelliSense in the code editor. But you can type the line of code, such
as
"TextBox1.AutoSize = False" in the code editor directly. When you build
the
project, there won't be any compilation error.

Hope this helps.

Sincerely,
Linda Liu
Microsoft Online Community Support

Sep 20 '07 #9

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

Similar topics

10
by: riki | last post by:
Hi, i have a big problem...i'm using one jscript for resizing of all of my pics in popUp...in main html i'm having many little pics and clicking on them they open in popUp and resize to larger...
0
by: nospam | last post by:
Does anyone know what would cause controls on a C# WinForm to resize when the form is saved. Buttons, panels, textboxes are all resizing themselves whenever I do a save for some inexplicable reason?
8
by: Grant | last post by:
Hello, Ive got a form with 3 textboxes - one under the other. When I set the anchor to top, left, right, and bottom for each of them and resize the form at runtime, they change size in relation...
11
by: Sharon | last post by:
I'm writing a new control derived from UserControl. I need to get an event when the control is done resizing. I tried the Resize, SizeChanged, Move and the Layout events and I also tried to...
13
by: Martin Ho | last post by:
I know this must be trivial for many of you. But I am playing with this and can't figure it out. I have a form, on that form is one panel which has 3 textboxes, when I run my program and...
0
by: Rachel | last post by:
I am developing an application for Windows Mobile devices using C#. I have a form that has several controls (labels and textboxes that are dynamically created on opening the form) and a vertical...
9
by: dli07 | last post by:
Hello, I'm trying to convert a piece of code that creates a dynamic vertical resizing bar in a table from internet explorer to firefox. It's based on a post from...
1
by: variaas | last post by:
Hey guys, I have a form with several textboxes (15+) that are in a tablelayoutpanel so they scale when the form is resized. Now when I resize the form, the action is very sluggish and slow. I'm...
10
by: mishrarajesh44 | last post by:
hii all, I am facing a problem currently.. i have a script for image uploading and resizing.. the image uploading takes place properly for every size images.. but, the resizing works for...
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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.