473,396 Members | 2,140 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,396 software developers and data experts.

TextBox padding

I'm still looking for a way to adjust the vertical
location of the text in a TextBox without overriding the
OnPaint. Any ideas?
Nov 15 '05 #1
4 14503
Mark,

Not sure if this is the kind of thing you mean, but:

1st set up a "Load" notification event for your parent
form (just double-click on the form, or do it manually
under events).

2nd, under the code for the "Load" method add the text in
the form that you want. This is an example of text that
I used copied from one of my programs (so ignore what it
says & just look at the spacing). I gave you two
different ways to enter text. I have the text
box's 'WordWrap' set to 'True' & 'ScrollBars' set
to 'vertical'. Hopefully this is the kind of thing your
were after.

======== BEGIN code #1 in "Load" method =======
this.textBox1.Clear();
this.textBox1.Text = @"After choosing a general 'System
of Units', then choose 'Custom' to change units
individually.

SI - International Standard for Metric Units.
SPE - Society of Petroleum Engineers Metric
Standard, June 1984 (www.spe.org).

Standards noted by {SI} and {SPE} are for general
guidance only. Standards often change depending on usage,
quantities, etc.

To include other units not shown, contact FSEG at 505-792-
1412 or cs****@attglobal.net.";
======== END code #1 in "Load" method =======

======== BEGIN code #2 in "Load" method =======
this.textBox1.Text = "After choosing a general 'System of
Units', then choose 'Custom' to change units
individually."+
"\r\n\r\nSI - International Standard for Metric Units."+
"\r\nSPE - Society of Petroleum Engineers Metric"+
"\r\n Standard, June 1984 (www.spe.org)."+
"\r\n\r\nStandards noted by {SI} and {SPE} are for
general guidance only. Standards often change depending
on usage, quantities, etc."+
"\r\n\r\nTo include other units not shown, contact FSEG
at 505-792-1412 or cs****@attglobal.net.";
======== END code #2 in "Load" method =======
-----Original Message-----
I'm still looking for a way to adjust the vertical
location of the text in a TextBox without overriding the
OnPaint. Any ideas?
.

Nov 15 '05 #2
1) you could create your own control. Add an outer panel1 to the control.
The control rectangle will size around this panel1 (panel1 will fill the
rectangle.) The panel will also handle things like border sytle to give you
your 3d border, etc. Now add a textbox (no border) inside the panel and
position it or add another panel (panel2) and put your textbox inside of it.
You can then pos panel2 anywhere inside panel1 to give you the vertical
space you need. The textbox can just fill panel2. You need to size
everthing and resize if the font changes, but this works as I have done this
before.

--
William Stacey, MVP

"Ma*********@hill.af.mil" <an*******@discussions.microsoft.com> wrote in
message news:0e****************************@phx.gbl...
I'm still looking for a way to adjust the vertical
location of the text in a TextBox without overriding the
OnPaint. Any ideas?

Nov 15 '05 #3
Thanks. I had considered doing something like this if
there weren't any better answers.
-----Original Message-----
1) you could create your own control. Add an outer panel1 to the control.The control rectangle will size around this panel1 (panel1 will fill therectangle.) The panel will also handle things like border sytle to give youyour 3d border, etc. Now add a textbox (no border) inside the panel andposition it or add another panel (panel2) and put your textbox inside of it.You can then pos panel2 anywhere inside panel1 to give you the verticalspace you need. The textbox can just fill panel2. You need to sizeeverthing and resize if the font changes, but this works as I have done thisbefore.

--
William Stacey, MVP

"Ma*********@hill.af.mil" <an*******@discussions.microsoft.com> wrote inmessage news:0e****************************@phx.gbl...
I'm still looking for a way to adjust the vertical
location of the text in a TextBox without overriding the OnPaint. Any ideas?

.

Nov 15 '05 #4
If you find one, please let me know. I had to do this myself to get around
an issue when you make the border 3D. It makes the text 1pic too close to
the top, so I had to use this method as I could not find a better way. All
ears however.
--
William Stacey, MVP

"Ma*********@hill.af.mil" <an*******@discussions.microsoft.com> wrote in
message news:07****************************@phx.gbl...
Thanks. I had considered doing something like this if
there weren't any better answers.
-----Original Message-----
1) you could create your own control. Add an outer

panel1 to the control.
The control rectangle will size around this panel1

(panel1 will fill the
rectangle.) The panel will also handle things like

border sytle to give you
your 3d border, etc. Now add a textbox (no border)

inside the panel and
position it or add another panel (panel2) and put your

textbox inside of it.
You can then pos panel2 anywhere inside panel1 to give

you the vertical
space you need. The textbox can just fill panel2. You

need to size
everthing and resize if the font changes, but this works

as I have done this
before.

--
William Stacey, MVP

"Ma*********@hill.af.mil"

<an*******@discussions.microsoft.com> wrote in
message news:0e****************************@phx.gbl...
I'm still looking for a way to adjust the vertical
location of the text in a TextBox without overriding the OnPaint. Any ideas?

.

Nov 15 '05 #5

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

Similar topics

6
by: rob | last post by:
Hi All, I have an asp script which updates upto 300000 records each time it is run. I would like to have a textbox which says records progressed : then in increments of 100 or 1000 whilst the...
10
by: Alex | last post by:
could someone please point me to a site with an explanation or give me a *very* simple example of a div that would open right below a textbox on a page. I've seen lots of examples out there....
0
by: Mark.Larsen | last post by:
Is there any way to adjust the size of the padding (empty space) around the text in a TextBox? I need to shift the text down a little from the top of a TextBox.
4
by: Rodrigo DeJuana | last post by:
Howdy, I'm new to this .net stuff and really have little to no training. Im trying to create a new page for a web form, so i have been pretty much jsut coping code. I having some issue with...
8
by: tshad | last post by:
I cannot seem to get the asp:textbox to use classes. Style works fine. I am trying to set the textbox to act like a label in some instance so it doesn't have a border, readonly and the background...
4
by: Usmaak | last post by:
Hi, I have a TextBox that is set to a certain width. From this, I need to figure out the max number of characters that can fit into the TextBox. I'm using Courier New font, size 8.25. I've...
8
by: Filipe Marcelino | last post by:
Hi, I'm trying to create a textbox inheriting from the standard textbox. I would like to: 1. repaint the textbox border; 2. define a color for that border; Till now I made this:
10
by: Per W. | last post by:
Is it possible to have dynamic size on a textbox? If the context is only one line then the box is only one line, but if the context is 10 lines then the box adjust to this? /Per W.
12
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
I want to plant an Easter Egg in our software. We have a TextBox that is multiline and used to display all sorts of messages on the screen for our operators based on database queries and such. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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
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,...

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.