Bitmap newpic;
        Bitmap oldpic;
      
for (int y = 1; y < oldpic.Height; y++)
            {
                for (int x = 1; x < oldpic.Width; x++)
                {
                    newColor = oldpic.GetPixel(oldpic.Width - x  , x);
                    newpic.SetPixel(x, y, newColor);
                }
                picShow.Image = newpic;这样貌似不行~!请高手指点

解决方案 »

  1.   

    Graphics.TranslateTransform 
    string filePath =@"C:\a.jpg"; 
                using (Bitmap bm = new Bitmap(500,500)) 
                { 
                    using (Graphics g = Graphics.FromImage(bm)) 
                    { 
                        g.Clear(Color.Wheat); 
                        g.TranslateTransform(0, 0, MatrixOrder.Prepend); 
                        g.RotateTransform(45); 
                        FontFamily ff = new FontFamily("宋体"); 
                        Font f =new Font(ff,10); 
                        Brush b = new SolidBrush(Color.Black); 
                        StringFormat sf = new StringFormat(); 
                        g.DrawString("", f, b, new PointF(10, 10), sf); 
                        g.DrawString("", f, b, new PointF(10, 10 + 30 + 10), sf); 
                    } 
                    bm.Save(filePath, ImageFormat.Jpeg); 
                } http://topic.csdn.net/u/20090420/00/4042e404-e802-45f7-8b25-c7fbc5a81c76.html
      

  2.   

    /// <summary>
    /// method to rotate an image either clockwise or counter-clockwise
    /// </summary>
    /// <param name="img">the image to be rotated</param>
    /// <param name="rotationAngle">the angle (in degrees).
    /// NOTE: 
    /// Positive values will rotate clockwise
    /// negative values will rotate counter-clockwise
    /// </param>
    /// <returns></returns>
    public static Image RotateImage(Image img, float rotationAngle)
    {
        //create an empty Bitmap image
        Bitmap bmp = new Bitmap(img.Width, img.Height);
     
        //turn the Bitmap into a Graphics object
        Graphics gfx = Graphics.FromImage(bmp);
     
        //now we set the rotation point to the center of our image
        gfx.TranslateTransform((float)bmp.Width / 2, (float)bmp.Height / 2);
     
        //now rotate the image
        gfx.RotateTransform(rotationAngle);
     
        gfx.TranslateTransform(-(float)bmp.Width / 2, -(float)bmp.Height / 2);
     
        //set the InterpolationMode to HighQualityBicubic so to ensure a high
        //quality image once it is transformed to the specified size
        gfx.InterpolationMode = InterpolationMode.HighQualityBicubic;
     
        //now draw our new image onto the graphics object
        gfx.DrawImage(img, new Point(0, 0));
     
        //dispose of our Graphics object
        gfx.Dispose();
     
        //return the image
        return bmp;

      

  3.   


    那么麻烦的!
    Image img = Image.FromFile("C:\\1.jpeg");
    img.RotateFlip(RotateFlipType.Rotate90FlipX);
    img.Save("C:\\2.jpeg");
    System.Drawing.RotateFlipType枚举
    // 摘要:
        //     指定图像的旋转方向和用于翻转图像的轴。
        public enum RotateFlipType
        {
            // 摘要:
            //     指定后接水平翻转和垂直翻转的 180 度旋转。
            Rotate180FlipXY = 0,
            //
            // 摘要:
            //     指定不进行旋转和翻转。
            RotateNoneFlipNone = 0,
            //
            // 摘要:
            //     指定后接水平翻转和垂直翻转的 270 度旋转。
            Rotate270FlipXY = 1,
            //
            // 摘要:
            //     指定不进行翻转的 90 度旋转。
            Rotate90FlipNone = 1,
            //
            // 摘要:
            //     指定不进行翻转的 180 度旋转。
            Rotate180FlipNone = 2,
            //
            // 摘要:
            //     指定没有后跟水平和垂直翻转的旋转。
            RotateNoneFlipXY = 2,
            //
            // 摘要:
            //     指定不进行翻转的 270 度旋转。
            Rotate270FlipNone = 3,
            //
            // 摘要:
            //     指定后接水平翻转和垂直翻转的 90 度旋转。
            Rotate90FlipXY = 3,
            //
            // 摘要:
            //     指定后接垂直翻转的 180 度旋转。
            Rotate180FlipY = 4,
            //
            // 摘要:
            //     指定没有后跟水平翻转的旋转。
            RotateNoneFlipX = 4,
            //
            // 摘要:
            //     指定后接水平翻转的 90 度旋转。
            Rotate90FlipX = 5,
            //
            // 摘要:
            //     指定后接垂直翻转的 270 度旋转。
            Rotate270FlipY = 5,
            //
            // 摘要:
            //     指定没有后跟垂直翻转的旋转。
            RotateNoneFlipY = 6,
            //
            // 摘要:
            //     指定后接水平翻转的 180 度旋转。
            Rotate180FlipX = 6,
            //
            // 摘要:
            //     指定后接垂直翻转的 90 度旋转。
            Rotate90FlipY = 7,
            //
            // 摘要:
            //     指定后接水平翻转的 270 度旋转。
            Rotate270FlipX = 7,
        }
      

  4.   

    [DllImport("gdiplus.dll", CharSet=CharSet.Unicode, SetLastError=true, ExactSpelling=true)]
    internal static extern int GdipImageRotateFlip(HandleRef image, int rotateFlipType);
     
      

  5.   

     Bitmap newpic;
            Bitmap oldpic;
            int newpicHeight;
            int newpicWidth;
    private void toolStripButton1_Click(object sender, EventArgs e)
            {
     newpicHeight = picShow.Image.Height;
                newpicWidth = picShow.Image.Width;
                newpic = new Bitmap(newpicHeight, newpicWidth);
                for (int y = 1; y < oldpic.Width; y++)
                {
                    for (int x = 1; x < oldpic.Height; x++)
                    {
                        newColor = oldpic.GetPixel(y,oldpic.Height-x);
                        newpic.SetPixel(x, y, newColor);
                    }
                    picShow.Image = newpic;
                }
      

  6.   

    c#封装的确实很强大了,支持下bitmap1.RotateFlip()方法