Windows 98-style progress bar

后端 未结 4 1477
轻奢々
轻奢々 2020-12-17 03:11

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.

4条回答
  •  Happy的楠姐
    2020-12-17 03:34

    I like Hans' answer but there's no need to override the control's class. You can remove the Win7 style from an individual control simply by calling SetWindowTheme using the control's handle. Here's an example:

    using System;
    using System.Windows.Forms;
    using System.Runtime.InteropServices;
    
    namespace MyApplication
    {
        public partial class Form1 : Form
        {
            [DllImport("uxtheme", ExactSpelling = true, CharSet = CharSet.Unicode)]
            public extern static Int32 SetWindowTheme(IntPtr hWnd,
                          String textSubAppName, String textSubIdList);
    
            public Form1()
            {
                InitializeComponent();
    
                // Remove Win7 formatting from the progress bar.
                SetWindowTheme(progressBar1.Handle, "", "");
    

提交回复
热议问题