### Bookstore

 Computer Math and Games in Pascal (preview) Lazarus Handbook

### Author Topic: Fill dual brush color in shape  (Read 813 times)

#### majid.ebru

• Sr. Member
• Posts: 455
##### Fill dual brush color in shape
« on: June 05, 2023, 10:47:45 pm »
Hi
I think that My question is very easy but i don't know the answer.
Can help or guide me how can fill brush color  circle shape like this ?!

#### wp

• Hero Member
• Posts: 11259
##### Re: Fill dual brush color in shape
« Reply #1 on: June 06, 2023, 09:16:35 am »
Use the RadialArc method of the Canvas for each half (https://lazarus-ccr.sourceforge.io/docs/lcl/graphics/tcanvas.radialpie.html). Besides the corners of the enclosing ellipse, it has the start angle and the angular length of the arc as parameters. Note that the angles are given in 1/16th of a degree.

#### majid.ebru

• Sr. Member
• Posts: 455
##### Re: Fill dual brush color in shape
« Reply #2 on: June 08, 2023, 06:15:58 am »
Use the RadialArc method of the Canvas for each half (https://lazarus-ccr.sourceforge.io/docs/lcl/graphics/tcanvas.radialpie.html). Besides the corners of the enclosing ellipse, it has the start angle and the angular length of the arc as parameters. Note that the angles are given in 1/16th of a degree.

thank WP

but when i change the form all color removed?

#### wp

• Hero Member
• Posts: 11259
##### Re: Fill dual brush color in shape
« Reply #3 on: June 08, 2023, 10:48:05 am »
but when i change the form all color removed?
What do you do when you "change" the form? Drag it to another place? Resize it? In the demo that I posted above, these operations have not effect. Or do you refer to a form in your own project? Do you paint outside the OnPaint event? This will not work (sometimes even be prohibited by the widgetset) because when the form gets the command to redraw itself it does not "know" how to do this.

#### majid.ebru

• Sr. Member
• Posts: 455
##### Re: Fill dual brush color in shape
« Reply #4 on: June 16, 2023, 08:22:58 pm »
Sorry late

For example when I minimize the form or change tab of page control and ....

#### wp

• Hero Member
• Posts: 11259
##### Re: Fill dual brush color in shape
« Reply #5 on: June 16, 2023, 11:42:25 pm »
Obviously you do not execute the drawing code in the OnPaint event of the control on which you want to draw.

Show us the code with which you want to display the dual-colored circle.