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. Image Rotation

Image Rotation

Scheduled Pinned Locked Moved C#
graphicsjsonhelp
1 Posts 1 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
    PHDENG81
    wrote on last edited by
    #1

    I have the following code to rotate an image: Image img=new Bitmap(400,400); //assigned to pictureBox 4 pictureBox4.Image=img; Graphics g=Graphics.FromImage(pictureBox4.Image); //Create a new matrix Matrix mm=new Matrix(); mm=new Matrix(1,0,0,-1,0,0); mm.Translate(25,104,MatrixOrder.Append); g.Transform=mm; Matrix mm1=new Matrix(); mm1.RotateAt( trackBar1.Value, new Point(67,2), MatrixOrder.Append); GraphicsPath gp=new GraphicsPath(); Image imgpic=(Image)Rotor_pictureBox.Image; gp.AddPolygon(new Point[]{new Point(0,Rotor_pictureBox.Height),new Point(Rotor_pictureBox.Width,Rotor_pictureBox.Height),new Point(0,0)}); gp.Transform(mm1); //get the resulting path points PointF[] pts=gp.PathPoints; //draw on the picturebox content of imgpic using the local transformation //using the resulting parralleogram described by pts g.DrawImage(imgpic,pts); pictureBox4.Refresh(); This code works great. However, I can't get the image to BrintToFront. I need it to rest on top of another picturebox. If there is another picture box within the rotating image's area, it covers it up. I tried to put an image WITHIN the picturebox that the rotating image is being drawn on, but it doesn't show up. Any help would be much appreciated. Thanks. D -- modified at 7:41 Wednesday 5th October, 2005

    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