I am trying to adjust the edit control width to fit the text it contains. How do I calculate the width (in pixel) for a string of a given font size?
Documentation on MQL5: Standard Constants, Enumerations and Structures / Objects Constants / Object Properties
- www.mql5.com
Standard Constants, Enumerations and Structures / Objects Constants / Object Properties - Documentation on MQL5
- String width and height in pixel
- Zoom state/level
- OBJ_LABEL maximum characters is?????
williamwong:
I am trying to adjust the edit control width to fit the text it contains. How do I calculate the width (in pixel) for a string of a given font size?
Seems like I am the only one encountering this difficulty? Just need a simple formula to convert 1 character of, say, Courier New font size 10, into pixel in width and height so that I can set the edit control to fix the width.
I am trying to adjust the edit control width to fit the text it contains. How do I calculate the width (in pixel) for a string of a given font size?
williamwong:
Seems like I am the only one encountering this difficulty? Just need a simple formula to convert 1 character of, say, Courier New font size 10, into pixel in width and height so that I can set the edit control to fix the width.
Seems like I am the only one encountering this difficulty? Just need a simple formula to convert 1 character of, say, Courier New font size 10, into pixel in width and height so that I can set the edit control to fix the width.
1 inch = 96 pixels = 72 points.
10 point character (monospaced) = width of character 'm' = 96/72*10 = 13.33 pixels
As far as I know, there's no strict dependance between the font size in points and its actual size in pixels. The ratio can be different for different fonts.
Documentation on MQL5: Standard Constants, Enumerations and Structures / Objects Constants / Object Properties
- www.mql5.com
Standard Constants, Enumerations and Structures / Objects Constants / Object Properties - Documentation on MQL5
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register