How to get BlockBlue Progressbars in Aero / .NET 4

I have three ProgressBars of three styles. Blocks and Continuous now turn out to be the same, whereas I remember the blocks used for rendering in the form of blocks.

http://www.kconnolly.net/pics/pb.jpg

is unique to .NET 4, Aero Glass, or Windows 7? How can I say that my application uses classic blocks?

+5
source share
1 answer

use this

public class ContinuousProgressBar : ProgressBar 
{ 
    public ContinuousProgressBar() 
    { 
        this.Style = ProgressBarStyle.Continuous; 
    }
    protected override void CreateHandle()
    {
        base.CreateHandle();
        try
        {
            SetWindowTheme(this.Handle, "", "");
        }
        catch 
        { 
        }
    }

    [System.Runtime.InteropServices.DllImport("uxtheme.dll")]  
    private static extern int SetWindowTheme(IntPtr hwnd, string appname, string idlist);
}
+1
source

All Articles