D
Dom
For various reasons, I've had to create my own control that allows me
to display text. The control will highlight a word by placing it in a
gray rectangle as the mouse flies over it. To do this, I split the
text into an array of words, and each word carries it's rectangle,
specifying the x, y, width, and height of the word. Each word is
composed of a string of "char-types" -- numeric, alpha, whitespace
(space and tab), or special (comma, semicolon, etc). For example, in
"Doe, John123" there are 5 words:
1. Doe
2. <comma>
3. <whitespace>
4. John
5. 123
The rectangle for each word is obtained through
CreateGraphics().MeasureString which gets passed four arguments:
1. The text
2. A Font object
3. A StringFormat object
4. The Client width.
The StringFormat object is created by "new StringFormat()". I've
tried various flags, but they don't fix the problem.
The problem is that each word has a noticable white space trailing
it. Sometimes it is large, sometimes small, but always there. This
makes the text look strange, especially with a space coming before the
commas.
Any advice?
to display text. The control will highlight a word by placing it in a
gray rectangle as the mouse flies over it. To do this, I split the
text into an array of words, and each word carries it's rectangle,
specifying the x, y, width, and height of the word. Each word is
composed of a string of "char-types" -- numeric, alpha, whitespace
(space and tab), or special (comma, semicolon, etc). For example, in
"Doe, John123" there are 5 words:
1. Doe
2. <comma>
3. <whitespace>
4. John
5. 123
The rectangle for each word is obtained through
CreateGraphics().MeasureString which gets passed four arguments:
1. The text
2. A Font object
3. A StringFormat object
4. The Client width.
The StringFormat object is created by "new StringFormat()". I've
tried various flags, but they don't fix the problem.
The problem is that each word has a noticable white space trailing
it. Sometimes it is large, sometimes small, but always there. This
makes the text look strange, especially with a space coming before the
commas.
Any advice?