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. Rotate rectangle with mouse move events...

Rotate rectangle with mouse move events...

Scheduled Pinned Locked Moved C#
graphicshelp
5 Posts 4 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.
  • P Offline
    P Offline
    priyareguri
    wrote on last edited by
    #1

    I have created an application to draw rectangle by using graphics..i got solution to resize,increase,decrease the rectangle..now i want rotate that rectangle...with mouse move events..(float angle should be dynamically).. ..i tried matrix rotation..but am not getting that how float angle will be generated dynamically by moving mouse... plzzzzzzz Help me...

    L 1 Reply Last reply
    0
    • P priyareguri

      I have created an application to draw rectangle by using graphics..i got solution to resize,increase,decrease the rectangle..now i want rotate that rectangle...with mouse move events..(float angle should be dynamically).. ..i tried matrix rotation..but am not getting that how float angle will be generated dynamically by moving mouse... plzzzzzzz Help me...

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      As was said the last time you asked this question...

      Dragonfly_lee wrote:

      1.listen the mouse click and move events. 2.Check the method - RotateTransform of Graphic object. E.g. gfx.RotateTransform(rotationAngle);

      Source[^]

      P 1 Reply Last reply
      0
      • L Lost User

        As was said the last time you asked this question...

        Dragonfly_lee wrote:

        1.listen the mouse click and move events. 2.Check the method - RotateTransform of Graphic object. E.g. gfx.RotateTransform(rotationAngle);

        Source[^]

        P Offline
        P Offline
        priyareguri
        wrote on last edited by
        #3

        ya i have seen that message..but rotation angle will be dynamically i want to mention..how should i calculate that rotation angle..when mouse moves on form..

        L M 2 Replies Last reply
        0
        • P priyareguri

          ya i have seen that message..but rotation angle will be dynamically i want to mention..how should i calculate that rotation angle..when mouse moves on form..

          L Offline
          L Offline
          l a u r e n
          wrote on last edited by
          #4

          well clearly he is saying that from the mouse click you can get the point where it was clicked ... then you can track the movement from that point to figure out a direction and hence the angle no? i think...

          "mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"

          1 Reply Last reply
          0
          • P priyareguri

            ya i have seen that message..but rotation angle will be dynamically i want to mention..how should i calculate that rotation angle..when mouse moves on form..

            M Offline
            M Offline
            musefan
            wrote on last edited by
            #5

            try storing the initial mouse click position then use that point, along with the center point of the object and the current mouse pos and use pythagaros (not sure on spelling) thery to calculate angle base on three point, oh you will also have to calculate the distance from points

            My opinion is... If someone has already posted an answer, dont post the SAME answer

            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