Linked Questions

48 votes
12 answers
60k views

I'd like to know if there's a better approach to this problem. I want to resize a label (vertically) to accomodate certain amount of text. My label has a fixed width (about 60 chars wide before it ...
Martin Marconcini's user avatar
61 votes
6 answers
77k views

A Java version of this question was just answered, and, well, I don't know how to do this in .net. So how do you calculate the display width of a string in C# / .net?
Jeffrey Meyer's user avatar
9 votes
2 answers
8k views

I have a changing sized image, and I would like to know which font size I should use to fit that dynamically changing size. As you know, there is a Graphics.MeasureString method, which calculates the ...
AFgone's user avatar
  • 1,280
4 votes
1 answer
3k views

I've been working on a custom control and I've run into an issue with TextRenderer acting a bit surprisingly. In my OnPaint event I apply transform to the Graphics object to compensate for the scroll ...
L.E.O's user avatar
  • 1,109
2 votes
3 answers
4k views

I have a pretty quick (and I'm hoping basic) question. I'm modifying some C# code for my company's website. The code draws a table for me in fixed columns, the data for which is pulled from a database....
user1591298's user avatar
2 votes
1 answer
4k views

I have a winform application on which I place a label. I change the text of the label dynamically from a background thread. The text change fires an event that is supposed to resize the label. ...
Zeos6's user avatar
  • 273
0 votes
1 answer
3k views

I have a DataGridView that I use as sort of a graphic for a 2D array. My issue is that I cannot figure out how, or if it is possible, to automatically scale the text in the cells to the size of the ...
KDecker's user avatar
  • 7,178
0 votes
1 answer
825 views

In my C# WinForms application, I have a control in which I display some text to the user on screen. For time being, assume it is a TextBox. My requirement is if the text does not fully fit within the ...
AllSolutions's user avatar
  • 1,276
3 votes
1 answer
800 views

Im drawing Text using the following code onto a Bitmap GraphicsPath pth = new GraphicsPath(); var style = (int)myfont.Style; pth.AddString(tcaption.Text, myfont.FontFamily, style, myfont.Size, point, ...
techno's user avatar
  • 6,604
1 vote
1 answer
894 views

I am trying to draw a multi-colored string. As there are no default methods to do this, I am trying to draw the string char by char myself using TextRenderer.DrawText, however, it does not report ...
Murumuru's user avatar
-3 votes
1 answer
814 views

I'm trying to get the height of a string. I've come across MeasureString but it's inaccurate for what I need it for - too small for what MS Word is showing (okay, this is probably another topic so if ...
Michael's user avatar
2 votes
1 answer
376 views

I am working on a UserControl that contains a multiline TextBox. When using my control, one will be able to set the text that will be displayed. The TextBox should then adapt its Height to make the ...
Martin Verjans's user avatar
2 votes
1 answer
171 views

TL;DR It seems the only piece I'm missing now is how to find the preferred width of a cell as it's being created. I need a replacement for Graphics.MeasureString that works for web forms. ORIGINAL ...
GeneralMike's user avatar
  • 2,991
0 votes
1 answer
94 views

I have tried a lot of things. Rectangle r = checkedListBox1.GetItemRectangle(0); checkedListBox1.ClientSize = new Size(checkedListBox1.PreferredSize.Width, checkedListBox1.PreferredSize.Height); Here ...
clamchoda's user avatar
  • 5,121