Rotating Buttons

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ali Rizwan
    Banned
    Contributor
    • Aug 2007
    • 931

    Rotating Buttons

    Can some tell me how can i make rotatry motion to control.
    Thanx
  • VBPhilly
    New Member
    • Aug 2007
    • 95

    #2
    Originally posted by Ali Rizwan
    Can some tell me how can i make rotatry motion to control.
    Thanx
    Do you have an example (say, a web page)? I'm not sure what is meant by rotary buttons.

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Originally posted by Ali Rizwan
      Can some tell me how can i make rotatry motion to control.
      Yes, I think we need more detail about what you mean. For instance, the first few questions that come to mind are...
      • What version of VB?
      • Do you mean that you just want to put a button on a form rotated to a different orientation to normal, or do you want something to be animated at runtime, or what?
      • Web page or Windows form?

      Comment

      • Ali Rizwan
        Banned
        Contributor
        • Aug 2007
        • 931

        #4
        Originally posted by Killer42
        Yes, I think we need more detail about what you mean. For instance, the first few questions that come to mind are...
        • What version of VB?
        • Do you mean that you just want to put a button on a form rotated to a different orientation to normal, or do you want something to be animated at runtime, or what?
        • Web page or Windows form?
        Hi
        I m using Vb6
        And want to make button rotating animation at runtime and its for windows form.
        i try to use sin cos etc but i cant i have never use them before so plz help me.

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          Originally posted by Ali Rizwan
          Hi
          I m using Vb6
          And want to make button rotating animation at runtime and its for windows form.
          i try to use sin cos etc but i cant i have never use them before so plz help me.
          Using Sin() and Cos() functions to generate coordinates for a circle is fairly simple. But I don't see how you can rotate a button. Perhaps you could create a little video/animation of a rotating button, and play it in an animation control.

          I'll attach a sample program I've just created, which demonstrates drawing a circle on the form using Sin and Cos. To use the sample, just run it and click in two different places on the form. It will draw a blue cross at the first place, then draw a circle around it, reaching to where you click the second time.
          Attached Files

          Comment

          • Ali Rizwan
            Banned
            Contributor
            • Aug 2007
            • 931

            #6
            Originally posted by Killer42
            Using Sin() and Cos() functions to generate coordinates for a circle is fairly simple. But I don't see how you can rotate a button. Perhaps you could create a little video/animation of a rotating button, and play it in an animation control.

            I'll attach a sample program I've just created, which demonstrates drawing a circle on the form using Sin and Cos. To use the sample, just run it and click in two different places on the form. It will draw a blue cross at the first place, then draw a circle around it, reaching to where you click the second time.
            Thanx a lot for this
            If i succeed to rotate a button then i will tell you and one thing more
            i want to know about animation control i know this but dont know how to use it
            Can you tell me

            Comment

            • Killer42
              Recognized Expert Expert
              • Oct 2006
              • 8429

              #7
              Originally posted by Ali Rizwan
              Thanx a lot for this
              If i succeed to rotate a button then i will tell you and one thing more
              i want to know about animation control i know this but dont know how to use it
              Can you tell me
              You'd have to find a video or create it using appropriate software. The animation control just lets you play a little AVI files. It's often used to do things like the "flying files" animation when copying files, the moving magnifying glass while searching, and so on.

              I don't remember how to use it, but I think it's pretty simple. You just give it the name of the AVI file to play.

              Comment

              • Ali Rizwan
                Banned
                Contributor
                • Aug 2007
                • 931

                #8
                Originally posted by Killer42
                You'd have to find a video or create it using appropriate software. The animation control just lets you play a little AVI files. It's often used to do things like the "flying files" animation when copying files, the moving magnifying glass while searching, and so on.

                I don't remember how to use it, but I think it's pretty simple. You just give it the name of the AVI file to play.
                Thanx for the reply
                I ll try

                Comment

                • Robbie
                  New Member
                  • Mar 2007
                  • 180

                  #9
                  Originally posted by Killer42
                  I'll attach a sample program I've just created, which demonstrates drawing a circle on the form using Sin and Cos. To use the sample, just run it and click in two different places on the form. It will draw a blue cross at the first place, then draw a circle around it, reaching to where you click the second time.
                  I know from programming in another language that you can draw 2 pictures - one of a button as it would normally be, and one of it when it is pressed down - then change the Picture of the PictureBox between them as the mouse is pressed and released, using those events and LoadPicture().

                  Your Sin/Cos can be adapted to get the colour of a pixel at one point and rotate it around by a certain number of degrees, then draw it again. This would be a very long-winded way, and probably introduce quite a lot of lag every time the picture is changed (because it would need to be rotated every time it's changed). It would also involve using a method similar to double-buffering, whereby you have 2 PictureBoxes but only 1 is visible; the first one would contain the original image which is having the colours of its pixels loooked at, and the second one (visible) is what the rotated pixels will be drawn onto.

                  I can't help with the sin/cos part, but I can help with getting the colour of a pixel, drawing a pixel, loading a new image file as the Picture for a PictureBox, and the double-buffering concept.

                  Now I'm not responsible if that all made no sense or typed weird typos, because it's 5:45 AM and I haven't been to sleep yet. ~_~"
                  Hopefully something useful can be made out of it ><

                  Comment

                  • Killer42
                    Recognized Expert Expert
                    • Oct 2006
                    • 8429

                    #10
                    Another thing to keep in mind. If your program has to generate the rotated images, you could do it once at startup and stash them in a bunch of picturebox controls or something. Then you won't have to worry about lag when displaying them.

                    Comment

                    Working...