ProgressBar and System.NotSupportedException

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Platform: WinCE, X86 device, C#

I want to use the ProgressBar control in my touchscreen application, but
when I try and set some properties (which are there in design time), I get a
System.NotSupportedException.
Here's my code:

this.progBar = new ProgressBar();
this.progBar.Size = new size(400,200);
this.progBar.ForeColor = Color.FromArgb(100,20,90);
this.progBar.BackColor = Color.FromArgb(200,220,250);
this.progBar.Font = new Font("Arial", 24,
System.Drawing.FontStyle.Bold);
// The below three calls cause System.NotSupportedException in
System.Windows.Forms.dll

this.progBar.Minimum = 1;
this.progBar.Maximum = 3;
this.progBar.Value = 1;
this.progBar.Show();

What's up? Am I missing a library or linking with incorrect library?

TIA.
Mark
 
Setting the Font property doesn't appear to be supported for the ProgressBar
control in the current release.
 
Yes, that was the problem.
I now have it displaying but it is not the topmost window. It seems as if it
z-order is behind all the child controls (Label, Button, PictureBox) on the
form.
 
Yes, that was the problem.

It now displays but the z-order is incorrect. It displays not as the topmost
window, but behind the Form's child controls (Label, Button, PictureBox).
 
I do not use the designer for my development because my forms all derive
from a System.Windows.Forms.Form derived class and I have not been very happy
with the code it generates.
Is their a way I can modify the z-order without using the designer?
 
Try changing the order in which you add it to the Forms Controls collection.

Cheers
Daniel
 
Yes, you can. The order in which you add controls to container is the
z-order:

this.Controls.Add(listBox1); // topmost
this.Controls.Add(listBox2); // will be placed under listBox1
// etc.


Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com
 
Yes the order of adding the ProgressBar to its container's Controls
collection does affect the z-order, but I have found - through trial and
error that if I add the ProgressBar first, before adding other controls it
will be placed under controls that are added later; conversely if I add the
ProgressBar control last, it will be the topmost window in the z-order.
 
Back
Top