I want to draw some marks over UltraProgressBar. I inherited from UltraProgressBar and overrided OnPaint method like this:
protected override void OnPaint(PaintEventArgs pe) { base.OnPaint(pe); using (Graphics gr = this.CreateGraphics()) { gr.FillRectangle(Brushes.Red, new Rectangle(10, 10, 10, 10)); } }
It's Ok when SupportThemes is true, but...! But when i want to switch SupportThemes to false it's broke at one stroke. No one of my marks is drawn.
What you will advise?
It's work!
below will be for myself :)
//
// in form
ucProgressBar.DrawFilter = new UcProgressBarIUIElementDrawFilter();
/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Обычная таблица"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}
class UcProgressBarIUIElementDrawFilter : IUIElementDrawFilter
{
public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams)
foreach (int position in XPosition)
drawParams.Graphics.FillRectangle(Brushes.Red, 0, 0, 10, 10);
}
return false;
public DrawPhase GetPhasesToFilter(ref UIElementDrawParams drawParams)
if (drawParams.Element.GetType() == typeof(ProgressBarUIElement))
return DrawPhase.AfterDrawElement | DrawPhase.AfterDrawImage;
return DrawPhase.None;
tnx. I'll try
I don't think that OnPaint is the right place to do this. Your best bet is likely to use a DrawFilter, examples of which can be found in the KB, as well as shipping with the NetAdvantage SDK. You might also find the UIElementViewer handy.
-Matt
Superman Mike, where are you?