473,787 Members | 2,989 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Scr een.Bounds.Widt h / 1024

Dim y As Decimal = My.Computer.Scr een.Bounds.Heig ht / 768

Dim mysizef As New SizeF(x, y)

frm.Scale(mysiz ef)

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

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 8447
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.Scr een.Bounds.Widt h / 1024

Dim y As Decimal = My.Computer.Scr een.Bounds.Heig ht / 768

Dim mysizef As New SizeF(x, y)

frm.Scale(mysiz ef)

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

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.mic rosoft.comwrote in message
news:Zz******** *******@TK2MSFT NGHUB02.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******** ********@TK2MSF TNGP02.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.Scr een.Bounds.Widt h / 1024

Dim y As Decimal = My.Computer.Scr een.Bounds.Heig ht / 768

Dim mysizef As New SizeF(x, y)

frm.Scale(mysiz ef)

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

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.mic rosoft.comwrote in message
news:6l******** ********@TK2MSF TNGHUB02.phx.gb l...
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.AutoS ize = 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.mic rosoft.comwrote in message
news:I9******** ********@TK2MSF TNGHUB02.phx.gb l...
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.AutoS ize = 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
2333
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 version of the same pic. now, it works fine and sometimes when i click on little one it doesn't resize well... this is the code: main.html
0
1022
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
7115
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 to the bottom of the form. This means the textbox on top stretches underneath the textbox below it... if you get my drift. Is there a webpage or something that shows how to correctly set up a form to maximise? Can it be set through the IDE? I...
11
17874
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 override them. But they all invoked when the control is in the middle of the resizing process. I'm not using breakpoints, I'm using trace to see which one is invoked and when.
13
2511
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 maximize the form I want to resize my 3 text boxes according to the size of the form. Each text box should take 33% of the panel's width and full hight of the panel's height. Resizing of the panel is easy with docking... but these 3 textboxes are driving...
0
2304
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 scroll bar. The number of controls varies. Everything works well and the scroll bar resizes acc to the number of controls. Only problem I am having is that when the user is entering data and the control is at the bottom of the form the scroll bar...
9
5313
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 http://blogs.crankygoblin.com/blogs/geoff.appleby/pages/50712.aspx. I've also read the post on this topic by bggraphics, but he doesn't arrive at a final result. The main problem I am having is that the layerX and layerY event properties don't work. They're supposed to return the...
1
1208
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 looking for best practices to improve performance on resizing the form. Are there any suggestions or resources to help me understand the best way to accomplish this? Thanks!
10
7078
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 only small sized iamages.. for eg. resizing takes place for 70 kb sized images but fails for 600kb or more.. my code is below..
0
9497
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10169
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9964
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7517
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.