EDN Admin
Well-known member
Hola,
Im a VB beginner.
Ive been playing with Graphics.DrawString by watermarking a picture with a text string. The picture below to the left comes from
PictureBox with a text string drawn with Graphics.DrawString. The font style used is Arial 48 points, regular, I think. The picture in PictureBox shows just as I configure. Great... The resolution of the original Terri
Hatcher picture is<span style="text-decoration:underline 300 dpi (300 x 300). Exporting this picture with Graphics.DrawString, I get the picture below to the right. The text string appears a lot bigger than previously shown in PictureBox.
It turns out that the text size varies, depending on the resolution of the original picture. Thats kind of odd. I develop several graphics applications in a different environment and have never seen this sort of graphics.drawstring thing. Anyway,
my sample application seems to draw a text string at an image resolution of <span style="text-decoration:underline
96dpi.
<img src="http://social.microsoft.com/Forums/getfile/32917/" alt="
I know that you can specify an image resolution after creating a new bitmap. But thats not a solution. Anyway, how can I keep the original resolution and draw a text string on user-selected image. Am I missing something? The following
is my code, by the way, for exporting (saving) an image. (myBrush As Brush, myFont As System.Drawing.Font)
<pre> Using sfd As New SaveFileDialog()
sfd.Filter = "Image files (*.jpg)|*.jpg"
If sfd.ShowDialog(Me) = Windows.Forms.DialogResult.OK Then
Dim g As Graphics = Graphics.FromImage(myPic)
g.DrawString(TextBox1.Text, myFont, myBrush, 0, 0)
g.Dispose()
myPic.Save(sfd.FileName, System.Drawing.Imaging.ImageFormat.Jpeg)
End If
End Using[/code]
Muchas gracias,
Onion <hr class="sig Onion is a recent refuge from Mac OS X and hates Mac App Store. System: Windows 7 x64
View the full article
Im a VB beginner.
Ive been playing with Graphics.DrawString by watermarking a picture with a text string. The picture below to the left comes from
PictureBox with a text string drawn with Graphics.DrawString. The font style used is Arial 48 points, regular, I think. The picture in PictureBox shows just as I configure. Great... The resolution of the original Terri
Hatcher picture is<span style="text-decoration:underline 300 dpi (300 x 300). Exporting this picture with Graphics.DrawString, I get the picture below to the right. The text string appears a lot bigger than previously shown in PictureBox.
It turns out that the text size varies, depending on the resolution of the original picture. Thats kind of odd. I develop several graphics applications in a different environment and have never seen this sort of graphics.drawstring thing. Anyway,
my sample application seems to draw a text string at an image resolution of <span style="text-decoration:underline
96dpi.
<img src="http://social.microsoft.com/Forums/getfile/32917/" alt="
I know that you can specify an image resolution after creating a new bitmap. But thats not a solution. Anyway, how can I keep the original resolution and draw a text string on user-selected image. Am I missing something? The following
is my code, by the way, for exporting (saving) an image. (myBrush As Brush, myFont As System.Drawing.Font)
<pre> Using sfd As New SaveFileDialog()
sfd.Filter = "Image files (*.jpg)|*.jpg"
If sfd.ShowDialog(Me) = Windows.Forms.DialogResult.OK Then
Dim g As Graphics = Graphics.FromImage(myPic)
g.DrawString(TextBox1.Text, myFont, myBrush, 0, 0)
g.Dispose()
myPic.Save(sfd.FileName, System.Drawing.Imaging.ImageFormat.Jpeg)
End If
End Using[/code]
Muchas gracias,
Onion <hr class="sig Onion is a recent refuge from Mac OS X and hates Mac App Store. System: Windows 7 x64
View the full article