Reputation: 483
I am using a ProgressBar which can be either of a Continuous or Blocks style (I cannot enable the visual styles in my application).
I made it work by advancing step by step
The code is like this one (looked on msdn):
private Timer timer = new Timer();
void progressbar1_visibleChanged(object sender, EventArgs e)
{
var progressb = sender as ProgressBar;
if (progressb != null && progressb.Visible == true)
{
InitializeProgress();
}
}
private void InitializeProgress()
{
progressBar1.Value = 0;
timer.Interval = 50;
timer.Tick += new EventHandler(IncreaseProgressBar);
timer.Start();
}
private void IncreaseProgressBar(object sender, EventArgs e)
{
if (progressBar1.Value >= progressBar1.Maximum)
{
progressBar1.Value = 0;
}
progressBar1.Increment(1);
}
(and the progress bar is shown\hidden from different workers that perform different actions)
How ever, it looks ugly to me, I would like it move from left to right\right to left.
How can I achieve that ?
Many thanks
Upvotes: 0
Views: 591
Reputation:
You need to Override CurrentCulture for WinForms control to a right-to-left language (such as Hebrew - "he" or "he-IL") which is a bit tricky as this is possible only for Threads (and not e.g. for forms or controls).
Then set the progress bar control property "RightToLeft" to "Yes", and "RightToLeftLayout" property to "True".
Now your progress bar should go RTL. If it doesn't or changing to RTL culture hurts more than it gives, the only option I can see is creating a custom control for the job.
Hope this helps!
Upvotes: 1