Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows 98-style progress bar

I use Windows 7, so my progress bars all have that green look. I'd like something a little more simplistic though, perhaps something resembling the Windows 98 progress bar.

Is there a simple way to change the style of the progress bar or will I have to recreate it manually?

like image 543
Pieter Avatar asked Oct 08 '10 19:10

Pieter


2 Answers

You cannot easily get the exact Win98 look without a pretty drastic rewrite of the control. But a simple flat light-blue progress bar can be had by turning off visual styles. Like this:

using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;

class SimpleProgressBar : ProgressBar {
    protected override void OnHandleCreated(EventArgs e) {
        base.OnHandleCreated(e);
        if (Environment.OSVersion.Version.Major >= 6) {
            SetWindowTheme(this.Handle, "", "");
        }
    }
    [DllImport("uxtheme.dll")]
    private static extern int SetWindowTheme(IntPtr hWnd, string appname, string idlist);
}
like image 157
Hans Passant Avatar answered Sep 20 '22 22:09

Hans Passant


Step 1: Download COMCTL32.ocx (version 5). I believe Version 5 is redistributable, though version 6 I think is not. The one I linked to is probably not the redist one, but that's the one I tested these steps on.
Step 2: Customize your toolbox and select the file you downloaded from the "COM Components" tab (by browsing for it).
Step 3: Add a Progressbar from the new toolbox entries.

Note: In the designer, it will still look kind of like a newer progressbar.

like image 41
Brian Avatar answered Sep 20 '22 22:09

Brian