Imports System.Drawing Imports System.Drawing.Drawing2D Imports System.Drawing.Imaging Public Class SignPhoto1 Inherits System.Web.UI.Page #Region " Codice generato da Progettazione Web Form " 'Chiamata richiesta da Progettazione Web Form. Private Sub InitializeComponent() End Sub Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Init InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load Dim objGraphics As Graphics Dim imgBack As System.Drawing.Image Dim ImgFile As String Dim ImgID As String Try ImgID = Request("ID").ToString().Replace("'", "''") ImgID = ImgID.Replace("\", "\\") Catch ImgID = "err" 'use a default error image End Try If Not IsNumeric(ImgID) Then ImgID = "err" 'default error image End If ImgFile = Server.MapPath("public/Photo/") + ImgID + ".jpg" imgBack = System.Drawing.Image.FromFile(ImgFile) Dim objBitMap As New Bitmap(imgBack) objGraphics = Graphics.FromImage(objBitMap) Dim pth As New GraphicsPath 'create the outline for the text "www.IRCLove.com" pth.AddString("www.IRCLove.com",_ New FontFamily("Verdana"),_ FontStyle.Bold, 22,_ New PointF(5, objBitMap.Height - 30),_ StringFormat.GenericTypographic) Dim outline As New Pen(Color.White, 1) 'select High Quality smoothing mode for better results objGraphics.SmoothingMode = SmoothingMode.HighQuality 'this is slower but grants a good quality result objGraphics.TextRenderingHint = _ Text.TextRenderingHint.SingleBitPerPixelGridFit 'let's draw the text outline objGraphics.DrawPath(outline, pth) outline.Dispose() pth.Dispose() objBitMap.Save(Response.OutputStream, ImageFormat.Jpeg) objBitMap.Dispose() objBitMap = Nothing objGraphics.Dispose() objGraphics = Nothing imgBack.Dispose() imgBack = Nothing End Sub End Class