![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
The image of the button can be formed either by uploading a ready-made bmp image or using drawing software (there are a lot of variants). And then simply processing mouse events in OnChartEvent to change its image.
I have heard about loading of a ready image. It is possible to change the image on mouse events. However, there is little possibility with such an approach. You need to load a lot of images. 4 pictures for four states + button label... In my opinion, a more interesting variant with software drawing. In short, we need to draw a button by calling the functionality of the canvas class. Draw lines of button sides with gradient 2 pixels wide (let's say). How difficult is it? It's interesting to know))
I've heard of loading a ready-made picture. It is possible to change the pictures at mouse events. However, there are not enough possibilities with this approach. You need a lot of pictures to load. 4 pictures for four states + button label... In my opinion, a more interesting variant with software drawing. In short, we need to draw the button by calling the canvas class functionality. Draw lines of button sides with gradient 2 pixels wide (let's say). How difficult is it? It's interesting to know))
It's not difficult. You just have to start doing it.
Yeah, I'll give it a try.
Yes, I'll give it a try.
By the way, why do I think the option with drawing is better, because if the number of buttons is large, and the buttons are different in size, then you need to upload a lot of pictures. Definitely not the best option. But with drawing buttons it's not clear yet. Do I have to solve the problem here too? :)
Maybe someone has already drawn the buttons?
By the way, why do I think the drawing option is better, because if the number of buttons is large, and the buttons are of different sizes, then there are a lot of pictures to upload. Clearly not the best option. But with drawing buttons it's not clear yet. Do I have to solve the problem here too? :)
Maybe someone has already drawn the buttons?
What's the problem, to draw 5-10 lines with different shade?
What's the problem, to draw 5-10 lines with different shade?
I don't. I don't know the kanvas class. That's why I'm asking. Can you draw a button?
You need to draw 2 states and change them on the press/release event. This is the topic of the thread. How realistic is it?
I don't know. I don't know the kanvas class. That is why I am asking. Can you draw a button?
You need to draw 2 states and change them on the press/release event. This is the topic of the thread. How realistic is that?
First you have to learn how to draw primitives - point, line, arc...
Then you take a canvas, fill in the background, draw a frame, draw lines with different shades - from light to dark - that's it - the button is ready...
First you have to learn how to draw primitives - point, line, arc...
Then you take a canvas, fill in the background, draw a frame, draw lines with different shades - from light to dark - that's it - the button is ready...
"What does it cost us to build a house - we'll draw it, we'll live".
It's a pity that in almost a year of the branch's existence no one has done that. Why don't you give it a try?
OK, I'll try it myself and I'll report the results. I won't get a normal OOP code though, but I'll try to make a button anyway.