Textbox text scrunched
-
Dear Sirs, I'm using a textbox control to display some text and the text on the right is appearing scrunched. It looks as though it displays the first x distance (I'm pretty sure it looks to be measured in distance, not characters) normally, and then squishes the characters (horizontally) taking out all character spacing so that they're not overlapping, but touching. Perhaps I'll give you a picture...I can't see how to insert one into the post, so I'll give you a link to my SkiDrive. My sky-drive photo. As you can see from the photo, the text is scrunched on one row, but not two rows down!! If you can tell me how to fix this, let me know. THANKS!!
In Christ, Aaron Laws http://ProCure.com
-
Dear Sirs, I'm using a textbox control to display some text and the text on the right is appearing scrunched. It looks as though it displays the first x distance (I'm pretty sure it looks to be measured in distance, not characters) normally, and then squishes the characters (horizontally) taking out all character spacing so that they're not overlapping, but touching. Perhaps I'll give you a picture...I can't see how to insert one into the post, so I'll give you a link to my SkiDrive. My sky-drive photo. As you can see from the photo, the text is scrunched on one row, but not two rows down!! If you can tell me how to fix this, let me know. THANKS!!
In Christ, Aaron Laws http://ProCure.com
one of three three things: If you are "creating your own" text box.. I really recomend against it.. use the Rich text or normal text box... but if you are you are using GDI+ to do the drawing in which case you should be using Graphics.DrawString()... not cycling threw your characters.. this looks like what the problem is.. remember that if your want to use this approach that you will need to add in the letter padding manually (
X+=3;
). Now if that is not the case: You may have inadvertently set a flag somewhere for your first string and then re initialized(clearing the flag) for the subsequent strings. Lastly if you are using different fonts, or units of measure you may get a squinched string... But you could post some code.. that might help. -
one of three three things: If you are "creating your own" text box.. I really recomend against it.. use the Rich text or normal text box... but if you are you are using GDI+ to do the drawing in which case you should be using Graphics.DrawString()... not cycling threw your characters.. this looks like what the problem is.. remember that if your want to use this approach that you will need to add in the letter padding manually (
X+=3;
). Now if that is not the case: You may have inadvertently set a flag somewhere for your first string and then re initialized(clearing the flag) for the subsequent strings. Lastly if you are using different fonts, or units of measure you may get a squinched string... But you could post some code.. that might help.Dear Mr. ely_bob, Thanks for your response! You know what...now that you mention it, It might be using
GDI+
that the text is being drawn. I just realized that theTextBox
control is used for EDITING the value, not displaying it! I keep forgetting that it's programmed that way. I'll look at it. So you think that maybe what's happenning is that thex += 2;
is not persisting; okay, I'll check it out. Thanks again.[====EDIT====]
It looks like this is the code used to draw the strings:
context.Graphics.DrawString(label, _font, _brush, clipRect, _format);
Yup...just checked, and I see where it drew my string. So...let's see. the arguments
label = "0.0\0.0\-25.0\0.0\0.0\-25.0\0.0\0.0\-25.0\0.0\0.0\-25.0\0.0\0.0\-25.0 "
_font = {[Font: Name=Microsoft Sans Serif, Size=8.25, Units=3, GdiCharSet=0, GdiVerticalFont=False]}
_brush = {System.Drawing.SolidBrush}
clipRect = {X=418,Y=768,Width=338,Height=16}
_format = {[StringFormat, FormatFlags=FitBlackBox, NoWrap, NoClip]}Now, I'm reading about the format.FitBlackBox property, it says "...By default, characters are repositioned to avoid any overhang." I would guess that this is the effect I'm complaining about, but after changing that, I still have the effect. Let me know what you think.
In Christ, Aaron Laws http://ProCure.com