Changing the colors of .NET-controls [XPA3.2]


Florian Groothuis
 

I'm using a .NET progressbar on several locations in my application, and it is always the default green color. I tried changing the color in several ways:

1. using an EvaluateExpression : DNSet(MyProgressbar.ForeColor,DotNet.System.Drawing.Color.Red)
2. using the object properties in the form. ForeColor = DotNet.System.Drawing.Color.Red
3. using .NET-code on the event MyProgressbar.OnPaint but thsi event is not triggered.

The .NET-code i'm trying to run:
public static void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
 Rectangle rec = e.ClipRectangle;
 ProgressBarRenderer.DrawHorizontalBar(e.Graphics, e.ClipRectangle);
 e.Graphics.FillRectangle(Brushes.Red, 2, 2, rec.Width, rec.Height);
 e.Graphics.FillRectangle(Brushes.Purple,2,2,rec.Width,rec.Height);
}

Is it possible to change he colors of this progress bar? If yes: how?

thanks in advance

Gr
Florian

Join main@magicu-l.groups.io to automatically receive all group messages.