Alexey Viktorov: Nikolay, is it possible to align the text to the top right corner. I've been struggling for half a day... I've aligned it to the right corner, but the text is aligned only to the left side. Can you give me a hint?
I know at least two ways.
Alexei, I'll show you as soon as I get to the computer, if you can't do it before then.
Alexey Viktorov: Nikolai, is it possible to align the text to the top right corner. I've been struggling for half a day... The right-hand corner is aligned, but the text is only aligned to the left side. Can you give me a hint?
That's not what I meant. The right-hand corner is fine. But if two or more lines of different length, they are aligned by the first character of the line. And I would like strings to be aligned by the last character of the string.
This is the first line.
This is the second line.
And this is the third line.
In the example on the first page, the second and third parts of the code use pixel shift or percentage shift. But the lines can only be aligned by indenting from the left edge. But this is not always convenient, especially if the length of the string can vary. For example "sum = 10" or "sum = 1000".
We alignOBJ_BITMAP_LABEL object by the right edge, we may indent it horizontally and vertically, we assign OBJPROP_ANCHOR to ANCHOR_RIGHT_UPPER. Then the width of the image is set when creating the resource. And this value should be put in TextOut as second parameter and then text will be aligned on right side of canvas.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Nikolay, is it possible to align the text to the top right corner. I've been struggling for half a day... I've aligned it to the right corner, but the text is aligned only to the left side. Can you give me a hint?
I know at least two ways.
set the anchor parameter in TextOut (and probably the object itself as well)
calculate the text size and take it into account )
set the anchor parameter in TextOut (and probably the object itself as well)
calculate text size and take it into account )
Nikolai, is it possible to align the text to the top right corner. I've been struggling for half a day... The right-hand corner is aligned, but the text is only aligned to the left side. Can you give me a hint?
I know at least two ways.
set the anchor parameter in TextOut (and probably the object itself as well)
calculate text size and take it into account )
That's not what I meant. The right-hand corner is fine. But if two or more lines of different length, they are aligned by the first character of the line. And I would like strings to be aligned by the last character of the string.
This is the first line.
This is the second line.
And this is the third line.
In the example on the first page, the second and third parts of the code use pixel shift or percentage shift. But the lines can only be aligned by indenting from the left edge. But this is not always convenient, especially if the length of the string can vary. For example "sum = 10" or "sum = 1000".It's strange that the topic has gone to Canvas. I've been doing this since time immemorial:
FS - font height.
PS example for top right :)
It's strange that the subject has gone to Canvas. I've been doing this since time immemorial:
FS - font height.
PS example for top right :)
That's how I've been able to do it for years too.
That's it, I've got it.
We alignOBJ_BITMAP_LABEL object by the right edge, we may indent it horizontally and vertically, we assign OBJPROP_ANCHOR to ANCHOR_RIGHT_UPPER. Then the width of the image is set when creating the resource. And this value should be put in TextOut as second parameter and then text will be aligned on right side of canvas.