MessageString method is not giving action Width [modified]
-
Hi all, I using MessageString method to calculate the string width. It is not giving the proper String Width. Eg: Font = "Arial 8.25"; Font.Style = Regular; string1 = "1234567890123456789012345678901234567890123456789012345678901" If you place this string to the label/TextBox. The actual width is 368px. But when i use graphics.MeasureString method it gives 387.9978. Is there any other method is available to calculate the string / what's the problem in this method. Some article says, Sometimes MeasureString method will give improper values. Is it true? Please tell me if anybody knows... Thanks.
Thanks & Regards Kumaran
modified on Monday, July 20, 2009 11:37 PM
-
Hi all, I using MessageString method to calculate the string width. It is not giving the proper String Width. Eg: Font = "Arial 8.25"; Font.Style = Regular; string1 = "1234567890123456789012345678901234567890123456789012345678901" If you place this string to the label/TextBox. The actual width is 368px. But when i use graphics.MeasureString method it gives 387.9978. Is there any other method is available to calculate the string / what's the problem in this method. Some article says, Sometimes MeasureString method will give improper values. Is it true? Please tell me if anybody knows... Thanks.
Thanks & Regards Kumaran
modified on Monday, July 20, 2009 11:37 PM
MeasureString actuall gives pixel representation of Actual Graphics Text string. It will be working when you are using a canvas to DrawString. Browser text size is not proper for this. I think the actual pixed depends on each browser. So very little help you have other than trial - error method to determine the size of the textbox. Love to see more replies if there is any alternative. :rose::rose:
Abhishek Sur My Latest Articles Working with Excel using MDAC
Basics on LINQ and Lambda Expressions
Create .NET Templates