S
Spaceman007
Hello all,
I need to render an image with text on it. this text needs to be align to
the right.
all works fine with the scipt on the end of the message, but I was no able
to align the text to the right.
I did not find a way to do this so far, did anyone have the same problem
already?
Thanks for input!
Greets
Spaceman
<%@ Page Language="VB" Debug="True" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%@ Import Namespace="System.Drawing.Text" %>
<%
' Declare Vars
Dim objBMP As System.Drawing.Bitmap
Dim objGraphics As System.Drawing.Graphics
Dim objFont As System.Drawing.Font
dim text
text = "align right..."
' Create new image - bitmap
objBMP = New Bitmap(431, 35)
' Create a graphics object to work with from the BMP
objGraphics = System.Drawing.Graphics.FromImage(objBMP)
' Fill the image with background color
objGraphics.Clear(Color.red)
' Set anti-aliasing for text to make it better looking
objGraphics.TextRenderingHint = TextRenderingHint.AntiAlias
' Configure font to use for text
objFont = New Font("Syntax", 20, FontStyle.bold)
' Write out the text
objGraphics.DrawString(text, objFont, Brushes.white, 3, 9)
' Set the content type and return the image
Response.ContentType = "image/GIF"
objBMP.Save(Response.OutputStream, ImageFormat.Gif)
' Kill our objects
objFont.Dispose()
objGraphics.Dispose()
objBMP.Dispose()
%>
I need to render an image with text on it. this text needs to be align to
the right.
all works fine with the scipt on the end of the message, but I was no able
to align the text to the right.
I did not find a way to do this so far, did anyone have the same problem
already?
Thanks for input!
Greets
Spaceman
<%@ Page Language="VB" Debug="True" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%@ Import Namespace="System.Drawing.Text" %>
<%
' Declare Vars
Dim objBMP As System.Drawing.Bitmap
Dim objGraphics As System.Drawing.Graphics
Dim objFont As System.Drawing.Font
dim text
text = "align right..."
' Create new image - bitmap
objBMP = New Bitmap(431, 35)
' Create a graphics object to work with from the BMP
objGraphics = System.Drawing.Graphics.FromImage(objBMP)
' Fill the image with background color
objGraphics.Clear(Color.red)
' Set anti-aliasing for text to make it better looking
objGraphics.TextRenderingHint = TextRenderingHint.AntiAlias
' Configure font to use for text
objFont = New Font("Syntax", 20, FontStyle.bold)
' Write out the text
objGraphics.DrawString(text, objFont, Brushes.white, 3, 9)
' Set the content type and return the image
Response.ContentType = "image/GIF"
objBMP.Save(Response.OutputStream, ImageFormat.Gif)
' Kill our objects
objFont.Dispose()
objGraphics.Dispose()
objBMP.Dispose()
%>