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

Adjusting Button height

Hi, I want to adjust button height based on label text.

Normally I have standard height because label text has one row, but the text
can change in runtime.
I want to adjust height of the button after text change, if the text is too
long and wraps to the second row and 3rd, and so on. The width of the button
never changes.

In other way I want to measure how much place takes text and adjust the size
od the button to show entire text.

regards,
Crosser
Nov 21 '05 #1
3 1449
"crosser" <cr*****@klub.chip.pl> schrieb:
Hi, I want to adjust button height based on label text.

Normally I have standard height because label text has one row, but the
text can change in runtime.
I want to adjust height of the button after text change, if the text is
too long and wraps to the second row and 3rd, and so on. The width of the
button never changes.


You can measure the text shown in the label using 'Graphics.MeasureString'
and then adjust the size of the button accordingly:

<URL:http://groups.google.de/groups?selm=eH5Ait%23KFHA.2804%40TK2MSFTNGP10.phx. gbl>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
J L
Hi Herfried,
Can you apply Graphics.MeasureString to other text such as the text in
a listview's column header? I tried to but the .Text property did not
support CreateGraphics. So is this just for Lables?

TIA,
John

On Mon, 21 Mar 2005 13:44:07 +0100, "Herfried K. Wagner [MVP]"
<hi***************@gmx.at> wrote:
"crosser" <cr*****@klub.chip.pl> schrieb:
Hi, I want to adjust button height based on label text.

Normally I have standard height because label text has one row, but the
text can change in runtime.
I want to adjust height of the button after text change, if the text is
too long and wraps to the second row and 3rd, and so on. The width of the
button never changes.


You can measure the text shown in the label using 'Graphics.MeasureString'
and then adjust the size of the button accordingly:

<URL:http://groups.google.de/groups?selm=eH5Ait%23KFHA.2804%40TK2MSFTNGP10.phx. gbl>


Nov 21 '05 #3
"J L" <jo**@marymonte.com> schrieb:
Can you apply Graphics.MeasureString to other text such as the text in
a listview's column header? I tried to but the .Text property did not
support CreateGraphics. So is this just for Lables?


The text in listview controls is drawn using GDI, so 'MeasureString' isn't
very useful in this situation at all.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4

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

Similar topics

1
by: Jesse Joseph Acosta | last post by:
Hi, Im working on a site for a friend, and we've setup a popup window for a couple pages, but with the code we have, the variables for the width and height are in the <script> portion of the code,...
6
by: Chris McGarry | last post by:
Hello, I am trying to use a heading tag in my pages but want to control the look via a style sheet. I am new at CSS but here's what I have so far: <HTML><HEAD> <STYLE TYPE="text/css"> H1...
2
by: Steve Le Monnier | last post by:
I've designed a user interface the uses the flat xp look for my controls, but the crazy decision by ms to make the combo box 1 pixel higher than a text box is really messing up my design. I...
1
by: Mark | last post by:
Hi All, I have set up a simple database to create labels for bottles. I insert a set number of records into a table and have produced a label report based on that table. After a bit of tweaking,...
3
by: Fredyy | last post by:
i am simply updating the innerHTML of a TD with text (replacing '\n' with '<br />'). In firefox, if i add one line to the existing i.e. Changing: 123 Your Street Town, State 12345 To: 123...
14
by: David C. Stone | last post by:
Is there a way in CSS to adjust the baseline position of text marked up with either <sup></supor <sub></sub>, relative to the surrounding text? Reason for asking is that the default rendering in...
5
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I want to be able to increase or decrease row heights of a populated DataGridView from the keyboard. I set up a test program with menu items to increase and decrease, assigned shortkey keys...
7
ddtpmyra
by: ddtpmyra | last post by:
Im trying to adjust the height of my text box and even I put height=100 still it display as regular text box. How can I make it larger? <input type="text" name="description" size="80"...
23
by: shashi shekhar singh | last post by:
Dear sir, I have a word document file contains text and images, now i have saved it as a web page and wants to display it on browser , using , string str=directory.getfiles("");...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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.