 |
|
Code (C#)
private void Page_Load(object sender, System.EventArgs e)
{
//Load the Image to be written on.
Bitmap bitMapImage = new System.Drawing.Bitmap( Server.MapPath("dallen.jpg" ) );
Graphics graphicImage = Graphics.FromImage( bitMapImage );
//Smooth graphics is nice.
graphicImage.SmoothingMode = SmoothingMode.AntiAlias;
//I am drawing a oval around my text.
graphicImage.DrawArc(new Pen(Color.Red, 3), 90, 235, 150, 50, 0, 360);
//Write your text.
graphicImage.DrawString( "That's my boy!", new Font("Arial", 12,FontStyle.Bold ), SystemBrushes.WindowText, new Point( 100, 250 ) );
//Set the content type
Response.ContentType="image/jpeg";
//Save the new image to the response output stream.
bitMapImage.Save(Response.OutputStream, ImageFormat.Jpeg);
//Clean house.
graphicImage.Dispose();
bitMapImage.Dispose();
}

จากตัวอย่าง ดึงรูป dallen.jpg เป็นรูปภาพพื้นหลังมา แต่อยากให้รูปไฟล์ .png เหมือนมี logo เพิ่มเติมในรูป
Tag : .NET, Web (ASP.NET), C#
|
|
 |
 |
 |
 |
Date :
2016-10-19 09:53:09 |
By :
moo |
View :
1717 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |