none
Marquee ProgressBar

    Question

  • I set ProgressBarStyle to Marquee, set marqueeanimationspeed = 100 and Application.EnableVisualStyles();
    Using .NET 2.0 under WindowsXP Pro XP2. But marquee style not working. The progressbar is always blank. How to make it run?
    Saturday, May 03, 2008 2:55 PM

All replies

  • I guess you have to change your operating system. 

    From the help files:

    Windows XP Home Edition, Windows XP Professional x64 Edition, Windows Server 2003 Platform Note:

    The Marquee style is supported only on these platforms.

    Edit:

    I tried it on a Vista home basic and an XP Pro SP2 (Media Center Edition) and it displayed a scrolling block on both.

    Edit:

    Look for this line:

    <EnableVisualStyles>true</EnableVisualStyles>

    In your Application.myapp file.
    Saturday, May 03, 2008 5:58 PM
  • So, I found a solution for this problem. When I set Windows theme to default, it's ok, marquee statusbar is working. But when I use another windows themes, progressbar is blank.
    What's the differents between

    <EnableVisualStyles>true</EnableVisualStyles>

    and using Application.EnableVisualStyles(); ???

    Sunday, May 04, 2008 6:20 AM
  • "What's the differents between

    <EnableVisualStyles>true</EnableVisualStyles>

    and using Application.EnableVisualStyles(); ???"

     

    You know it's in the location where it will take effect.

    Sunday, May 04, 2008 6:31 AM
  • I placed it into my app.config, but after application's execution there is an exception like this "Something wrong with System.Transactions.Diagnostics.DiagnosticTrace". I can't give you original messsage of exception because it's on russian language.
    Sunday, May 04, 2008 6:48 AM
  • If you are using VB  <EnableVisualStyles>true</EnableVisualStyles> should be in your Application.myapp file.

    If you are using C#  Application.EnableVisualStyles(); should be in your Main method.  Usually in your Program.cs file.

    VisualStyles have to be enabled before a window is created.
    Sunday, May 04, 2008 7:06 AM
  • So. I'm using C# and in my Program.cs
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    Application.Run(new MainForm());

    But it doesn't affect to progressbar. it is always blank 8(
    Sunday, May 04, 2008 7:33 AM
  • Hi Sergey,

     

    It would be appreciated if you provide code that invokes ProgressBar to show. Then I can see what’s going on about your ProgressBar.

     

    However, based on my experience, it’s probably caused by the execution of other methods, such as looping, which have blocked ProgressBar from showing successfully.

     

    This case usually happens when you are doing some looping and you want to show progress at the same time. If your code is looping very fast, then ProgressBar’s events would not be handled, hence would not be redrawn.

     

    If your problem is caused by what I have said, I would like to suggest you explicitly call Application.DoEvent() near your looping code segment, which can ask Framework handle Control events and redraw all controls.

     

    Here is a code sample:

    Code Snippet

            private void button1_Click(object sender, EventArgs e)

            {

                progressBar1.Style = ProgressBarStyle.Marquee;

                while (sometasknotfinished)

                {

                    processtask();

                    progressBar1.Increment();

                    Application.DoEvents();

                }

                progressBar1.Style = ProgressBarStyle.Blocks;

             }

     

    Notice: I’d like to remind you that if you call Application.DoEvent() too often, that could cause a heavy performance bottleneck, which is not a good design.

     

    Hope this helps. If there is anything unclear, please feel free to let me know.

     

    Best wishes,

    Jun Wang

     

    Friday, May 09, 2008 8:35 AM
  • I didn't use marquee progressbar in loops.
    The task is show marquee progressbar after clicking on the button on the form. For example:
    We have new form, button and progressbar. When I click on the button, progresbar should be marquee. That's all.

    But if we use another windows theme, not a microsoft's themes, but themes from different programs like WindowBlinds so marquee progressbar didn't work.

    The question is how to use marquee progressbar in themes differents to standart microsoft's themes?
    Saturday, May 10, 2008 4:04 PM