WPF Custom Draw Multiple Progress Bar

When processing a group of elements, I wanted to display a unified image of the group status, so I essentially made a Grid from a series of progressbars with a transparent background and different colored front parts in the same cell.

sample image http://i40.tinypic.com/2lksj6x.png

I come across some transparency artifacts (the purple bar is actually purple under green, and sometimes to the top, etc.), and it just seems a little wasteful. So, I decided to do mine, but now I have paralysis on how to do it. Am I using DrawingContext in FrameworkElement OnRender, or is there something simpler? Is there a set of general rules when it comes to creating your own control?

I thought about switching to a pie chart, as they are easily accessible, but at the time I did something not ready.

Thanks!

+3
source share
1 answer

I'm not quite sure how you intend for the progress bar to combine different successes, but if you say that further progress is at the bottom of the z-index and the least progress is at the top, then I would do something like that:

1) I would probably create a user control for this new spotlight.

2) It will have a property called NumberOfProgresses, which is associated with an array containing the state of the specified progressions.

3) (, , - ), wpf . background , , borderbrush . .

4) UpdateProgress, .

5) ( * ) Z, /, horizontaly, , , .

, , OnRender()... , WPF OnRender this OnRender, , WinForms OnPaint. , , WPF ;)

. , . , , , , / .

+1

Source: https://habr.com/ru/post/1707369/


All Articles