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. C#
  4. TrackBar

TrackBar

Scheduled Pinned Locked Moved C#
csharphelpquestion
8 Posts 3 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.
  • N Offline
    N Offline
    Nicolas Marzoni
    wrote on last edited by
    #1

    Hello, I am working on my final project at the university. I need a .net TrackBar or a similar control to set an upper-limit, a lower-limit and a setting value. Could somebody help me? :confused: Thank you so much.

    Nicolás.

    C 1 Reply Last reply
    0
    • N Nicolas Marzoni

      Hello, I am working on my final project at the university. I need a .net TrackBar or a similar control to set an upper-limit, a lower-limit and a setting value. Could somebody help me? :confused: Thank you so much.

      Nicolás.

      C Offline
      C Offline
      Calla
      wrote on last edited by
      #2

      http://msdn.microsoft.com/en-us/library/system.windows.forms.trackbar.aspx[^]

      N 1 Reply Last reply
      0
      • C Calla

        http://msdn.microsoft.com/en-us/library/system.windows.forms.trackbar.aspx[^]

        N Offline
        N Offline
        Nicolas Marzoni
        wrote on last edited by
        #3

        Thanks for your answer Calla, I all ready saw that page. But that control only have one slider. Do you know if there is a similar control with 3 sliders? Tranks again.

        Nicolás.

        D 1 Reply Last reply
        0
        • N Nicolas Marzoni

          Thanks for your answer Calla, I all ready saw that page. But that control only have one slider. Do you know if there is a similar control with 3 sliders? Tranks again.

          Nicolás.

          D Offline
          D Offline
          DaveyM69
          wrote on last edited by
          #4

          There aren't any in-built ones. Search for .NET Range controls and you may find something that suits. If not, it's fairly easy to code your own if it's only for one type of value such as an int.

          Dave

          If this helped, please vote & accept answer!

          Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
          BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)

          N 1 Reply Last reply
          0
          • D DaveyM69

            There aren't any in-built ones. Search for .NET Range controls and you may find something that suits. If not, it's fairly easy to code your own if it's only for one type of value such as an int.

            Dave

            If this helped, please vote & accept answer!

            Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
            BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)

            N Offline
            N Offline
            Nicolas Marzoni
            wrote on last edited by
            #5

            Hello Dave. Yes, it is for one type of values. Do you have some example or a reference?

            Nicolás.

            D 3 Replies Last reply
            0
            • N Nicolas Marzoni

              Hello Dave. Yes, it is for one type of values. Do you have some example or a reference?

              Nicolás.

              D Offline
              D Offline
              DaveyM69
              wrote on last edited by
              #6

              I don't unfortunately. I did code one myself a while ago but never used it in the end - I'll have a dig through my backups at home and see if I can find it but it may take me a day or two to locate it.

              Dave

              If this helped, please vote & accept answer!

              Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
              BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)

              1 Reply Last reply
              0
              • N Nicolas Marzoni

                Hello Dave. Yes, it is for one type of values. Do you have some example or a reference?

                Nicolás.

                D Offline
                D Offline
                DaveyM69
                wrote on last edited by
                #7

                Perhaps you could modify this code[^] and add a value property?

                Dave

                If this helped, please vote & accept answer!

                Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
                BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)

                1 Reply Last reply
                0
                • N Nicolas Marzoni

                  Hello Dave. Yes, it is for one type of values. Do you have some example or a reference?

                  Nicolás.

                  D Offline
                  D Offline
                  DaveyM69
                  wrote on last edited by
                  #8

                  Hi, I've had a look through my files and I never completed it as it was no longer required. You are welcome to use what I did and finish it off if you'd like. The main things that need doing are marked // ToDo: - unfortunately that includes the painting and mouse handling - but the Range struct is pretty much complete and the main code for the control is in place.

                  // Range.cs
                  using System;

                  namespace DaveyM69
                  {
                  [Serializable]
                  public struct Range : IEquatable<Range>
                  {
                  // ToDo: Make struct designer friendly!

                      public static readonly Range Empty = new Range();
                      public static readonly Range MaxRange = new Range(int.MinValue, int.MaxValue);
                      public static readonly Range Percentage = new Range(0, 100);
                  
                      private int lower;
                      private int upper;
                  
                      public Range(int lower, int upper)
                      {
                          if (lower > upper)
                          {
                              int newUpper = lower;
                              lower = upper;
                              upper = newUpper;
                          }
                          this.lower = lower;
                          this.upper = upper;
                      }
                  
                      public static bool operator ==(Range rangeA, Range rangeB)
                      {
                          return (rangeA.lower == rangeB.lower) && (rangeA.upper == rangeB.upper);
                      }
                      public static bool operator !=(Range rangeA, Range rangeB)
                      {
                          return !(rangeA == rangeB);
                      }
                  
                      public int Lower
                      {
                          get { return lower; }
                      }
                      public int Upper
                      {
                          get { return upper; }
                      }
                  
                      public Range Adjust(int offset)
                      {
                          return new Range(lower + offset, upper + offset);
                      }
                      public int Contain(int value)
                      {
                          return Contain(value, false);
                      }
                      public int Contain(int value, bool excludeExtremities)
                      {
                          Range testRange = excludeExtremities ? this.Expand(-1) : this;
                          if (value < testRange.lower)
                              return testRange.lower;
                          if (value > testRange.upper)
                              return testRange.upper;
                          return value;
                      }
                      public Range Contain(Range range)
                      {
                          return Contain(range, false);
                      }
                      public Range Contain(Range range, bool excludeExtremities)
                      {
                          if (Contains(range, excludeExtremities))
                              return range;
                          int newLower = range.lower;
                  
                  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