![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
canvas.Rectangle is not an object, it's a command to draw a bunch of pixels. It's like a gunshot - a bullet goes off, and good riddance. There's no feedback.
Thanks for the no feedback - got it.
There is an article titled Exploring the CCanvas class.Implementation of transparency of graphical objects, there should be a solution.
I have viewed it 217 times and it is open now, but I haven't seen any solution.
I need live example of changing canvas and frame colour in OnTick().
Thank you!
Thanks for the connection - got it.
I've looked at it 217 times, and it's open now, but I haven't seen a solution.
Need a live example of changing canvas and frame colour in OnTick().
Thank you!
Based on my code, just stuck in changing the canvas colour and drawing a frame.
Since I use colours with transparency, I specified"COLOR_FORMAT_ARGB_NORMALIZE" when creating the canvas:
Based on my own code, I just put in a change of canvas colour and draw a frame.
Since I use colours with transparency, I specified"COLOR_FORMAT_ARGB_NORMALIZE" when creating the canvas:
I'll take a look now, thanks!
What I expected to get - got a long time ago, it's a barely transparent canvas with a frame and selection, but now I need to change the colours, which doesn't work.
I'll have a look now, thanks!
What I expected to get - got long ago, it's a barely transparent canvas with a border and a selection, but now I need to change the colours, which doesn't work.
Probably the problem is ENUM_COLOR_FORMAT (when creating the canvas) and the method of getting the colour.
In OnInit I create a canvas
Then I need to change the colour at 10:00 to grey in OnTick and return it to the original state again at 11:00.
It doesn't work:
Question:
How do I change the colour of the canvas and frame - no reference to object names?
Thank you!
I have a feeling you've messed around with the colours.
What is the meaning of this line:
COLOR_FORMAT_ARGB_NORMALIZE does not need to fill the canvas with the background colour, but rather to fill it with zero:
canvas.Erase(0);
for it means that the canvas is completely transparent.
It is also convenient to use the 16-color representation:
for example:
0x00000000 - fully transparent black
0xFF000000 - opaque black
0xFFFFFFFFFF - opaque white
0xFFFF0000 - opaque red
0xFF00FF00 - opaque green
0xFF0000FF - opaque blue
0x8000FF00 - translucent green
0x80FFFFFFFF - translucent black
0xFF808080 - grey
etc.
Probably a problem with ENUM_COLOR_FORMAT (when creating the kanvas) and the method of getting the colour.
Problem solved.
My code didn't have the canvas removed when I closed the terminal, so it was already on the chart on startup, so it didn't initialize, and the property changes didn't know where to apply.
Thanks all!
I have a feeling you've messed with the colours.
What's the point of that line?
The point of the line is that without it you get this picture
If with the line, then that's right, a nice frame with my chosen colour
Problem solved.
My code didn't remove the canvas when I closed the terminal, so it was already on the chart when I started, so it didn't initialise, and the property changes didn't know where to apply.
Thanks all!
Hmmm, you really can't guess where the dog is at once :)
Demonstration of a script with bitmap scaling
In the Ex5 file sits a fairly large BMP file as a resource.
Raster Scaling Script Demonstration
No, it's really impressive.
But, you have to make some kind of useful add-on that takes advantage of all those Canvas features.
So that your developments would not suffer the same fate as the CGA adapter - a wonderful graphic adapter, misunderstood and underestimated by its contemporaries.
I myself always considered CGA to be "lame as ever" losing to Commodore 64 or Sinclair Spectrum eight-bit graphics. But recently it turned out that, simply because of lack of popularity - almost nobody used all the opportunities of this card. And there were almost no games that could compete with eight-bit home computers.
Had IBM promoted CGA, had this demo appeared in 1981 - CGA would have been much more popular, and possibly EGA would have been released later:
When I look at this screen, I can't believe that this is possible on old CGA adapter with its 16K videomemory, connected to a common household TV (RGB monitor isn't suitable for this at all. That was the idea of the developers - higher quality text on RGB monitor, but poor colour palette, but rich graphical possibilities with bad readable text on household TV with a composite input)