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. track bar int too double ?

track bar int too double ?

Scheduled Pinned Locked Moved C#
question
6 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.
  • J Offline
    J Offline
    jtmtv18
    wrote on last edited by
    #1

    whats the easyest way too adjust a track bar value from 1 too 100, into a double starting at 1.0 and working its way down to .0001 (for form opacity). i have it working with a huge switch, but i want a cleaner way to take the int value of say 100 too the double value of .0001

    D 1 Reply Last reply
    0
    • J jtmtv18

      whats the easyest way too adjust a track bar value from 1 too 100, into a double starting at 1.0 and working its way down to .0001 (for form opacity). i have it working with a huge switch, but i want a cleaner way to take the int value of say 100 too the double value of .0001

      D Offline
      D Offline
      David Stone
      wrote on last edited by
      #2

      form.Opacity = (double)trackBar.Value / 1000000; I think that should work... :~


      I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past. -Chris Maunder Microsoft has reinvented the wheel, this time they made it round. -Peterchen on VS.NET

      J S 2 Replies Last reply
      0
      • D David Stone

        form.Opacity = (double)trackBar.Value / 1000000; I think that should work... :~


        I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past. -Chris Maunder Microsoft has reinvented the wheel, this time they made it round. -Peterchen on VS.NET

        J Offline
        J Offline
        jtmtv18
        wrote on last edited by
        #3

        thanks alot =) you just gave me back 200 lines of code i bet.. (it looks like that would work too me too...) im going too school as we speak to get my mcsd from a microsoft certified school.. for someone trying to become a windows app programmer (eventually games) is this a good start ?

        D 1 Reply Last reply
        0
        • D David Stone

          form.Opacity = (double)trackBar.Value / 1000000; I think that should work... :~


          I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past. -Chris Maunder Microsoft has reinvented the wheel, this time they made it round. -Peterchen on VS.NET

          S Offline
          S Offline
          stephen woolhead
          wrote on last edited by
          #4

          That will not work... 1 = 0.000001 100 = 0.0001 Depends if you want a linear function or a power function see http://www.perfectphase.com/store/slider.gif[^] Stephen.

          D 1 Reply Last reply
          0
          • J jtmtv18

            thanks alot =) you just gave me back 200 lines of code i bet.. (it looks like that would work too me too...) im going too school as we speak to get my mcsd from a microsoft certified school.. for someone trying to become a windows app programmer (eventually games) is this a good start ?

            D Offline
            D Offline
            David Stone
            wrote on last edited by
            #5

            Actually, I would look at this article instead. It seems to work: http://www.codeproject.com/csharp/transparentwindowsincsharp.asp[^] I think Game Dev would be better done in C++. You can do it in C#, but I haven't really seen a game written in C# aside from Chris Sells' Wahoo[^]


            I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past. -Chris Maunder Microsoft has reinvented the wheel, this time they made it round. -Peterchen on VS.NET

            1 Reply Last reply
            0
            • S stephen woolhead

              That will not work... 1 = 0.000001 100 = 0.0001 Depends if you want a linear function or a power function see http://www.perfectphase.com/store/slider.gif[^] Stephen.

              D Offline
              D Offline
              David Stone
              wrote on last edited by
              #6

              You're right. I should have just done this:

              Form.Opacity = trackBar.Value / 100;


              I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past. -Chris Maunder Microsoft has reinvented the wheel, this time they made it round. -Peterchen on VS.NET

              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