P
Programmer
Hi all
Here is my problem
I want to create an image so i can pass it on an object to put it as
watermark in my pdf report
Here is what i have write so far
Dim objBitmap As System.Drawing.Bitmap
Dim objGraphics As System.Drawing.Graphics
Dim cstream As System.IO.MemoryStream
Dim c As System.Drawing.Image
objBitmap = New System.Drawing.Bitmap(width, height)
objGraphics = System.Drawing.Graphics.FromImage(objBitmap)
Dim drawFont As New System.Drawing.Font("Arial", 32)
Dim drawBrush As New System.Drawing.SolidBrush(System.Drawing.Color.Black)
' Create point for upper-left corner of drawing.
Dim x As Single = 0.0F
Dim y As Single = 0.0F
' Set format of string.
Dim drawFormat As New System.Drawing.StringFormat
drawFormat.FormatFlags = System.Drawing.StringFormatFlags.DirectionVertical
g.DrawString("IMAGE TEXT", drawFont, drawBrush, x, y, drawFormat)
objBitmap.save ("c:\temp\a.jpg")
objBitmap.Save(cstream, System.Drawing.Imaging.ImageFormat.Jpeg)
c = System.Drawing.Image.FromStream(cstream)
c.Save("c:\temp\b.jpg")
Now if you look at the a.jpg and b.jpg the a.jpg contains an image that
writes the "IMAGE TEXT"
but b.jpg is totaly BLACK!!!!!
What i'm doing wrong??
Thank you for your time
Here is my problem
I want to create an image so i can pass it on an object to put it as
watermark in my pdf report
Here is what i have write so far
Dim objBitmap As System.Drawing.Bitmap
Dim objGraphics As System.Drawing.Graphics
Dim cstream As System.IO.MemoryStream
Dim c As System.Drawing.Image
objBitmap = New System.Drawing.Bitmap(width, height)
objGraphics = System.Drawing.Graphics.FromImage(objBitmap)
Dim drawFont As New System.Drawing.Font("Arial", 32)
Dim drawBrush As New System.Drawing.SolidBrush(System.Drawing.Color.Black)
' Create point for upper-left corner of drawing.
Dim x As Single = 0.0F
Dim y As Single = 0.0F
' Set format of string.
Dim drawFormat As New System.Drawing.StringFormat
drawFormat.FormatFlags = System.Drawing.StringFormatFlags.DirectionVertical
g.DrawString("IMAGE TEXT", drawFont, drawBrush, x, y, drawFormat)
objBitmap.save ("c:\temp\a.jpg")
objBitmap.Save(cstream, System.Drawing.Imaging.ImageFormat.Jpeg)
c = System.Drawing.Image.FromStream(cstream)
c.Save("c:\temp\b.jpg")
Now if you look at the a.jpg and b.jpg the a.jpg contains an image that
writes the "IMAGE TEXT"
but b.jpg is totaly BLACK!!!!!
What i'm doing wrong??
Thank you for your time