Connecting Tech Pros Worldwide Forums | Help | Site Map

How can I rotate an image by certain degree

Mullin Yu
Guest
 
Posts: n/a
#1: Nov 15 '05
I can create an image object with a string printed on it. But, how I can
rotate the whole image 270 degree clockwise

static public Bitmap createSerial()
{
Graphics objGraphics;
string strSerialNo = "20031124123456-1";

// Create a bitmap...
//System.Drawing.Bitmap imgBitmap = new Bitmap(200, 30,
PixelFormat.Format32bppArgb);
System.Drawing.Bitmap imgBitmap = new Bitmap(170, 30);

// Select graphic
objGraphics = Graphics.FromImage(imgBitmap);

objGraphics.Clear(Color.White);

// Select Font
Font titleFont = new Font("Arial", 12f);

// Draw the title string
objGraphics.DrawString(strSerialNo, titleFont, new
SolidBrush(Color.Black), 10, 1);

// Rotate Image

return imgBitmap;
}


Miha Markic
Guest
 
Posts: n/a
#2: Nov 15 '05

re: How can I rotate an image by certain degree


Hi,

Did you try Image.RotateFlip method?

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com

"Mullin Yu" <mullin_yu@ctil.com> wrote in message
news:eOWP1H$sDHA.2444@TK2MSFTNGP12.phx.gbl...[color=blue]
> I can create an image object with a string printed on it. But, how I can
> rotate the whole image 270 degree clockwise
>
> static public Bitmap createSerial()
> {
> Graphics objGraphics;
> string strSerialNo = "20031124123456-1";
>
> // Create a bitmap...
> //System.Drawing.Bitmap imgBitmap = new Bitmap(200, 30,
> PixelFormat.Format32bppArgb);
> System.Drawing.Bitmap imgBitmap = new Bitmap(170, 30);
>
> // Select graphic
> objGraphics = Graphics.FromImage(imgBitmap);
>
> objGraphics.Clear(Color.White);
>
> // Select Font
> Font titleFont = new Font("Arial", 12f);
>
> // Draw the title string
> objGraphics.DrawString(strSerialNo, titleFont, new
> SolidBrush(Color.Black), 10, 1);
>
> // Rotate Image
>
> return imgBitmap;
> }
>
>[/color]


Closed Thread


Similar C# / C Sharp bytes