Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows Forms
  4. TrackBar appearance inconsistency

TrackBar appearance inconsistency

Scheduled Pinned Locked Moved Windows Forms
visual-studiographicsquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    John Whitmire
    wrote on last edited by
    #1

    I have two test apps (acquired from different sources) that include the System.Windows.Forms.TrackBar. The relevant settable properties seem to be equivalent and in the VS Designer, the TrackBars look the same in both apps. But when running, their appearance is different. One has the green bars on the slider and the other doesn't. There must be something different, but I can't find it. :confused: Will someone point me in the right direction? This one shows the green highlight bars. All this code is in the form constructor.

    tBarBalance = new System.Windows.Forms.TrackBar();
    tBarBalance.AutoSize = false;
    tBarBalance.Location = new System.Drawing.Point(x, y);
    tBarBalance.Maximum = 320;
    tBarBalance.Minimum = -320;
    tBarBalance.Name = "tBarBalance";
    tBarBalance.Size = new System.Drawing.Size(60, 30);
    tBarBalance.TickFrequency = 320;
    tBarBalance.TabIndex = i;
    tBarBalance.SmallChange = 10;
    tBarBalance.LargeChange = 50;
    tBarBalance.Tag = line;
    tBarBalance.ValueChanged += new System.EventHandler(tBarBalance_ValueChanged);
    this.Controls.Add(tBarBalance);

    This one doesn't have the green highlight. This code is in the InitializeComponent method. I tried it without the BeginInit and EndInit calls, but that made no difference. The non-default AutoSize = false (from above) made no difference either.

    trkBalance = new TrackBar();
    ((System.ComponentModel.ISupportInitialize)(trkBalance)).BeginInit();
    trkBalance.Location = new System.Drawing.Point(56, 46);
    trkBalance.Maximum = 10000;
    trkBalance.Minimum = -10000;
    trkBalance.Name = "trkBalance";
    trkBalance.Size = new System.Drawing.Size(108, 45);
    trkBalance.TabIndex = 1;
    trkBalance.TickFrequency = 1000;
    toolTip.SetToolTip(trkBalance, "Balance");
    trkBalance.Scroll += new System.EventHandler(trkBalance_Scroll);
    this.Controls.Add(trkBalance);
    ((System.ComponentModel.ISupportInitialize)(trkBalance)).EndInit();

    What say ye?

    L 1 Reply Last reply
    0
    • J John Whitmire

      I have two test apps (acquired from different sources) that include the System.Windows.Forms.TrackBar. The relevant settable properties seem to be equivalent and in the VS Designer, the TrackBars look the same in both apps. But when running, their appearance is different. One has the green bars on the slider and the other doesn't. There must be something different, but I can't find it. :confused: Will someone point me in the right direction? This one shows the green highlight bars. All this code is in the form constructor.

      tBarBalance = new System.Windows.Forms.TrackBar();
      tBarBalance.AutoSize = false;
      tBarBalance.Location = new System.Drawing.Point(x, y);
      tBarBalance.Maximum = 320;
      tBarBalance.Minimum = -320;
      tBarBalance.Name = "tBarBalance";
      tBarBalance.Size = new System.Drawing.Size(60, 30);
      tBarBalance.TickFrequency = 320;
      tBarBalance.TabIndex = i;
      tBarBalance.SmallChange = 10;
      tBarBalance.LargeChange = 50;
      tBarBalance.Tag = line;
      tBarBalance.ValueChanged += new System.EventHandler(tBarBalance_ValueChanged);
      this.Controls.Add(tBarBalance);

      This one doesn't have the green highlight. This code is in the InitializeComponent method. I tried it without the BeginInit and EndInit calls, but that made no difference. The non-default AutoSize = false (from above) made no difference either.

      trkBalance = new TrackBar();
      ((System.ComponentModel.ISupportInitialize)(trkBalance)).BeginInit();
      trkBalance.Location = new System.Drawing.Point(56, 46);
      trkBalance.Maximum = 10000;
      trkBalance.Minimum = -10000;
      trkBalance.Name = "trkBalance";
      trkBalance.Size = new System.Drawing.Size(108, 45);
      trkBalance.TabIndex = 1;
      trkBalance.TickFrequency = 1000;
      toolTip.SetToolTip(trkBalance, "Balance");
      trkBalance.Scroll += new System.EventHandler(trkBalance_Scroll);
      this.Controls.Add(trkBalance);
      ((System.ComponentModel.ISupportInitialize)(trkBalance)).EndInit();

      What say ye?

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Hi, Have a look at Application.EnableVisualStyles(); maybe that is the relevant difference between both apps. :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      Fixturized forever. :confused:


      J 1 Reply Last reply
      0
      • L Luc Pattyn

        Hi, Have a look at Application.EnableVisualStyles(); maybe that is the relevant difference between both apps. :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        Fixturized forever. :confused:


        J Offline
        J Offline
        John Whitmire
        wrote on last edited by
        #3

        Thanks, that's exactly it. Application.EnableVisualStyles(); was the difference. :doh:

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups