🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.csharpbuilder.graphics
3 messages
3 total messages Started by Ron Sawyer Thu, 06 Apr 2006 22:06
Text Extent?
#1
Author: Ron Sawyer
Date: Thu, 06 Apr 2006 22:06
12 lines
1386 bytes
I am using C# to do some graphics development.  I have to output a small
graphic to a canvas and center a string under it.  In the windows API world
I would get the extent of the text (I think it was called GetTextExtent or
something similar, I'd have to look it up.)  I would use the resultant width
and height to help me center the text output.

For the life of me I can't figure out how to do this with .Net graphics
objects.

Can anyone tell me how or direct me to a resource to guide me?

Thanks!
Re: Text Extent?
#2
Author: Marc Rohloff TeamB
Date: Thu, 06 Apr 2006 22:43
13 lines
1639 bytes
On Thu, 6 Apr 2006 18:06:32 -0400, Ron Sawyer wrote:

> I am using C# to do some graphics development.  I have to output a small
> graphic to a canvas and center a string under it.  In the windows API world
> I would get the extent of the text (I think it was called GetTextExtent or
> something similar, I'd have to look it up.)  I would use the resultant width
> and height to help me center the text output.

Get hold of a Graphics object and call the MeasureString method.

-- 
Marc Rohloff [TeamB]
marc rohloff -at- myrealbox -dot- com
Re: Text Extent?
#3
Author: Ron Sawyer
Date: Fri, 07 Apr 2006 00:26
10 lines
1283 bytes
Excellent.  Thanks, I was looking for TextExtent, GetTextExtent, all kinds
of things like that.  I will try that first thing in the morning!

(wow, fast service too!  Thanks!)

> Get hold of a Graphics object and call the MeasureString method.
>
> -- 
> Marc Rohloff [TeamB]
> marc rohloff -at- myrealbox -dot- com
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads