![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello. I have a label component on my code. I need to calculate the exact size of pixels before putting a text into it. (calculating the size in pixel, by having the font and the text value). How can I do that ? Thanks ![]() |
#3
| |||
| |||
|
|
On Jul 8, 6:13 pm, "Mr. X." <nospam.... (AT) gmail (DOT) com> wrote: Hello. I have a label component on my code. I need to calculate the exact size of pixels before putting a text into it. (calculating the size in pixel, by having the font and the text value). How can I do that ? Thanks ![]() You may want to look at MeasureString method: http://msdn.microsoft.com/en-us/library/system.drawing.graphics.measurestring.aspx http://www.thescarms.com/dotnet/MeasureString.aspx HTH, Onur Güzel |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
That's the function I need. Another thing. I don't have a graphics object. How can I resolve it from the object : (should I ?) (I.e DataGridView.Columns(0) ) ? Thanks ![]() |
#6
| |||
| |||
|
|
Thanks. Is there a common letter to be measured? (suppose I have 5 letters : is it XXXXX, WWWWW, PPPPP). Thanks ![]() "Onur Güzel" <kimiraikkonen85 (AT) gmail (DOT) com> wrote in message news:750a1d0c-5df8-40e7-8e44-a2f354b26de9 (AT) x27g2000yqb (DOT) googlegroups.com... On Jul 8, 6:13 pm, "Mr. X." <nospam.... (AT) gmail (DOT) com> wrote: Hello. I have a label component on my code. I need to calculate the exact size of pixels before putting a text into it. (calculating the size in pixel, by having the font and the text value). How can I do that ? Thanks ![]() You may want to look at MeasureString method: http://msdn.microsoft.com/en-us/library/system.drawing.graphics.measurestring.aspx http://www.thescarms.com/dotnet/MeasureString.aspx HTH, Onur Güzel |
#7
| |||
| |||
|
|
Then you create a string and measure that given by the method by Onur What is your problem, seems so obvious to me? "Mr. X." <nospam.mry (AT) gmail (DOT) com> wrote in message news:i14s1g$k00$1 (AT) news (DOT) eternal-september.org... Thanks. Is there a common letter to be measured? (suppose I have 5 letters : is it XXXXX, WWWWW, PPPPP). Thanks ![]() "Onur Güzel" <kimiraikkonen85 (AT) gmail (DOT) com> wrote in message news:750a1d0c-5df8-40e7-8e44-a2f354b26de9 (AT) x27g2000yqb (DOT) googlegroups.com... On Jul 8, 6:13 pm, "Mr. X." <nospam.... (AT) gmail (DOT) com> wrote: Hello. I have a label component on my code. I need to calculate the exact size of pixels before putting a text into it. (calculating the size in pixel, by having the font and the text value). How can I do that ? Thanks ![]() You may want to look at MeasureString method: http://msdn.microsoft.com/en-us/library/system.drawing.graphics.measurestring.aspx http://www.thescarms.com/dotnet/MeasureString.aspx HTH, Onur Güzel |
#8
| |||
| |||
|
|
It's a datagrid, which represents rows from database. and it is dynamic grid that can show not a specific table, but the one I request. Because I cannot figure out what is the exact size in pixels of each row, I need to calculate it approximately for a specific letter multiply by the maximum size * 80%. (I have read this long time ago). |
#9
| |||
| |||
|
#10
| |||
| |||
|
|
I have a label component on my code. I need to calculate the exact size of pixels before putting a text into it. (calculating the size in pixel, by having the font and the text value). |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |