Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27203

[RESOLVED] How to count the number of trims in StringTrimming?

$
0
0
Hello,

I have a question with a string trimming. I have to print a string in a rectangle. If the string exceeds the rectangle width then I need to trim the string. For this I am using this code:
Code:


Dim formatText As New StringFormat
formatText.Trimming = StringTrimming.Word

'Code that doesn't matter for my question

e.Graphics.DrawString(dataGridView1.Item(x, y).Value.ToString, Font, Brushes.Black, New Rectangle(pozX, pozY,fixedWidth, rowHeight), formatText)

My question is: how can I count the number of trims? I need this because my rowHeight variable has to be increased with each trimming in order to create the necessary space.

Later, I will use these values to draw a rectangle around the string.

Thx.

Viewing all articles
Browse latest Browse all 27203

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>