473,405 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Text Size (Extent?)

Hi,

MFC has functions that calculate the width and height of a
text string, GetTextExtent being one of them. Does .NET/C#
have an equivalent?

Or how does one do this in C#?

Thanks,
Gary
Jan 13 '06 #1
3 3684
Hi,
Systrem.Drawing.Graphics.MeasureString(...)
--
Milosz Skalecki
MCP, MCAD
"Gary Brown" wrote:
Hi,

MFC has functions that calculate the width and height of a
text string, GetTextExtent being one of them. Does .NET/C#
have an equivalent?

Or how does one do this in C#?

Thanks,
Gary

Jan 13 '06 #2
I can see that .net is going to be fun.
I need the length of a string so I start with SystemDrawing, but I'm not
drawing anything.

Then I use Graphics but to me a string is not graphics.

Then finally I MeasureString.

My concept of logic goes right out the window.

Galen S

"Milosz Skalecki" <mi*****@REMOVEITwp.pl> wrote in message
news:5C**********************************@microsof t.com...
Hi,
Systrem.Drawing.Graphics.MeasureString(...)
--
Milosz Skalecki
MCP, MCAD
"Gary Brown" wrote:
Hi,

MFC has functions that calculate the width and height of a
text string, GetTextExtent being one of them. Does .NET/C#
have an equivalent?

Or how does one do this in C#?

Thanks,
Gary

Jan 13 '06 #3
Sorry, but i don't understand your complaint :). You wanted an equivalent of
the GetTextExtent function which computes the width and height of a line of
text using the current font. If you want just a length of a string just use
MyStringInstance.Length :)

Regards
--
Milosz Skalecki
MCP, MCAD
"Galen Somerville" wrote:
I can see that .net is going to be fun.
I need the length of a string so I start with SystemDrawing, but I'm not
drawing anything.

Then I use Graphics but to me a string is not graphics.

Then finally I MeasureString.

My concept of logic goes right out the window.

Galen S

"Milosz Skalecki" <mi*****@REMOVEITwp.pl> wrote in message
news:5C**********************************@microsof t.com...
Hi,
Systrem.Drawing.Graphics.MeasureString(...)
--
Milosz Skalecki
MCP, MCAD
"Gary Brown" wrote:
Hi,

MFC has functions that calculate the width and height of a
text string, GetTextExtent being one of them. Does .NET/C#
have an equivalent?

Or how does one do this in C#?

Thanks,
Gary


Jan 16 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Joe Patrick | last post by:
On my websites index.html page I have this script: <SCRIPT language="JavaScript"> <!-- // if ((screen.width==1024) && (screen.height==768)) { document.write('<a href="active.html">Click here</a>...
2
by: Billy | last post by:
Hi, This is in connection to the tread: Re: changing browser text settings?? I am wondering if there is a way to retrieve the browsers text size (not change! ;-) ) so that I can dynamically...
3
by: Marti | last post by:
Dear everyone, Its my understanding that IE6 now uses a default text-size of "Small" rather than IE5's "Medium". Since I have used relative font-sizes (usually in ems) on all my sites, I am...
9
by: Peter | last post by:
Hi at all, how can I do to make a css file to change automatically the text size of the text that is into a table relatively the screen size? I.E. if the screen is 800 x I want the text...
4
by: Der Kommissar | last post by:
Hi all I've been working on a site, in which I had to use tables for layout, but I've used CSS to style the text and a few other things. http://www.cultuurnet.be/ The site seems to work as...
11
by: dmsy | last post by:
Is there a way to use javascript to increase the overall document text size, just like if you click View->Text Size->Largest, Larger, Medium, Smaller, Smallest? This is on IE browser.
14
by: Roger Withnell | last post by:
How to I find out what size text the browser is set to? Thanks in anticipation.
2
by: ghall426 | last post by:
I've read numerous articles about the font-size problems, but am confused about a couple of things. I'm using Microsoft Expression Web. The drop-down box that lets me select text size shows medium...
5
by: Deepan HTML | last post by:
I am having a html code like below: <tr><td bgcolor=#5CB3FF><h6>(Tentative)</h6></td></tr> I want to remove this h6 tag from this and i still want to reduce the text size. I am not sure as...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.