2

I would like to know i have removed Application.EnableVisualStyles () as the program i develop for progress bar it will be easier if i remove that statement of "Application.EnableVisualStyles". The problem i face was, when i put datetimepicker i set the showupdown to true, the arrow in show up down does not display as formerly with the statement "Application.EnabledStyles". Is there a way i can solve it without addding "Application.EnableVisualStyles". Thanks

It is like this for the datetimepicker enter image description here

i want like this for the datetimepicker with the enabled visual style removed enter image description here

Software Engineer
  • 471
  • 1
  • 4
  • 20

1 Answers1

1

If you just want to use the old ProgressBar, this Hans Passant answer How do I disable visual styles for just one control, and not its children? shows how to turn visual styles off for a single control. I've adapted that code for your progress bar:

public class OldProgressBar : ProgressBar {

  [DllImportAttribute("uxtheme.dll")]
  private static extern int SetWindowTheme(IntPtr hWnd, string appName, string idlist);

  protected override void OnHandleCreated(EventArgs e) {
    SetWindowTheme(this.Handle, "", "");
    base.OnHandleCreated(e);
  }
}

Now you can use Application.EnableVisualStyles(); and still use the old progress bar control.

Community
  • 1
  • 1
LarsTech
  • 80,625
  • 14
  • 153
  • 225