Making a crowdsourced project on Canvas - page 21

 
Nikolai Semko:

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))
 
Реter Konow:

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.
 
Artyom Trishkin:
It's not difficult. You just have to start doing it.

Yeah, I'll give it a try.
 
Реter Konow:

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?

 
Реter Konow:


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?
 
Taras Slobodyanik:

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?

 
Реter Konow:


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...
 
Taras Slobodyanik:

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. It's true that I won't be able to produce normal OOP code, but I'll try to make the button anyway.
 
Реter Konow:
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.
I've almost finished the GButton class sample but I have to run away. Tomorrow I will finish it and show it to you.