String length to Pixels

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hello all,

I am trying to "draw" a string onto a graphic

Dim pGraphics As System.Drawing.Graphics
pGraphics.DrawString(TheText, drawFont, drawBrush, 100, 100)

but I need to find out the Length of the string in pixels so that I can auto
place it correctly in the picture (instead of using 100,100).

Anyone know how to get the size of a text string in pixels.

Thanks
Brad
 
Hi,

Take a look at the graphics class measurestring method.

http://msdn.microsoft.com/library/d...temdrawinggraphicsclassmeasurestringtopic.asp

Ken
------------------
hello all,

I am trying to "draw" a string onto a graphic

Dim pGraphics As System.Drawing.Graphics
pGraphics.DrawString(TheText, drawFont, drawBrush, 100, 100)

but I need to find out the Length of the string in pixels so that I can auto
place it correctly in the picture (instead of using 100,100).

Anyone know how to get the size of a text string in pixels.

Thanks
Brad
 
Hi,
Is Graphics.MeasureString() what you are looking for?

hello all,

I am trying to "draw" a string onto a graphic

Dim pGraphics As System.Drawing.Graphics
pGraphics.DrawString(TheText, drawFont, drawBrush, 100, 100)

but I need to find out the Length of the string in pixels so that I can auto
place it correctly in the picture (instead of using 100,100).

Anyone know how to get the size of a text string in pixels.

Thanks
Brad
 
Back
Top