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. How to Rotate Controls?

How to Rotate Controls?

Scheduled Pinned Locked Moved C#
tutorialgraphicshelpquestion
5 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.
  • R Offline
    R Offline
    RajeshGuptha
    wrote on last edited by
    #1

    Hi, I want to rotate a control, take for example a button Control or a label control to some angle. But i dont know how to attain that.. i tried setting the region of the control with a graphics path whose transform set to rotate about its center...but im not able to get the output... Can anybody help me? Thanks, Rajesh

    D 1 Reply Last reply
    0
    • R RajeshGuptha

      Hi, I want to rotate a control, take for example a button Control or a label control to some angle. But i dont know how to attain that.. i tried setting the region of the control with a graphics path whose transform set to rotate about its center...but im not able to get the output... Can anybody help me? Thanks, Rajesh

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Off the top of my head, you'll have to create your own version of the controls you want to visually rotate and supply the functionality for it. There may be another way to do it by dropping the controls in some other container and rotating the container somehow, but i really can't see that happening. Another option is a 3rd party Windows Forms Control library. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      T 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Off the top of my head, you'll have to create your own version of the controls you want to visually rotate and supply the functionality for it. There may be another way to do it by dropping the controls in some other container and rotating the container somehow, but i really can't see that happening. Another option is a 3rd party Windows Forms Control library. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        T Offline
        T Offline
        therealmccoy
        wrote on last edited by
        #3

        Right off the very tip top of my head.... Could you just decrement the X size/location and increment the Y size/location in a for loop (or do loop)? The text wouldn't rotate, but the control would appear too. Just a thought. Of course you have to mark your start position and reverse at 90 degrees, etc, etc... www.lovethosetrains.com

        D 1 Reply Last reply
        0
        • T therealmccoy

          Right off the very tip top of my head.... Could you just decrement the X size/location and increment the Y size/location in a for loop (or do loop)? The text wouldn't rotate, but the control would appear too. Just a thought. Of course you have to mark your start position and reverse at 90 degrees, etc, etc... www.lovethosetrains.com

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          No, it wouldn't. It would just make the button appear tall and narrow, not rotated to any angle. Re-read the original post... RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          R 1 Reply Last reply
          0
          • D Dave Kreskowiak

            No, it wouldn't. It would just make the button appear tall and narrow, not rotated to any angle. Re-read the original post... RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

            R Offline
            R Offline
            RajeshGuptha
            wrote on last edited by
            #5

            Actually i tried transforming the region of the control to a rotation... for example, Region reg = new Region(); Matrix matObj = new Matrix(); matObj.RotateAt(/*some angle*/, /*with respect to some point*/); reg.Transform(matobj); myControl.Region = reg; Iam able to attain the rotation...but supposing the region (reg in this example)is in another shape(than rectangle)...say ellipse, then the shape of the ellipse is not visible completely....reason is that the rectangle coordinates(i.e. the original rectangle size) used to draw the ellipse is smaller than the rotated structure...(after rotation, the location of points are actually out of the bounds of the controls client rectangle...) So i tried to get the size of the outer rectangle which has completely both the original and the rotated rectangles... by some trignometry... but nope, im not getting the exact coordinates... can you help me in this?? I Thanks and Regards, Rajesh

            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