473,473 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Get size (in pixels) of a string

I need to know the size (in pixels) of a string painted on a graphic
component

Any idea?

tnx
Nov 17 '05 #1
3 9469
Hello,
you can use MeasureString method of Graphics object to get string's
width and height in pixels..

HTH. Cheers
Maqsood Ahmed [MCP,C#]
Kolachi Advanced Technologies
http://www.kolachi.net

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #2
You could also use MeasureCharacterRanges

On Sun, 22 May 2005 08:28:16 +0200, Maqsood Ahmed <ma***********@gawab.com> wrote:
Hello,
you can use MeasureString method of Graphics object to get string's
width and height in pixels..

HTH. Cheers
Maqsood Ahmed [MCP,C#]
Kolachi Advanced Technologies
http://www.kolachi.net

*** Sent via Developersdex http://www.developersdex.com ***


--
Happy coding!
Morten Wennevik [C# MVP]
Nov 17 '05 #3

Thanks!

Nov 17 '05 #4

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

Similar topics

5
by: Stu Cazzo | last post by:
I have the following: String myStringArray; String myString = "98 99 100"; I want to split up myString and put it into myStringArray. If I use this: myStringArray = myString.split(" "); it...
5
by: John | last post by:
A text book says "a string's size is independent of the length of the string it addresses". Why? For example, string st1( "foobar" ); string st2( "a mighty oak" ); cout << "st1: " << sizeof(...
5
by: Sehboo | last post by:
Hi, Is there any easy way to limit the size of the string? I have Private msDescription As String I want to limit the msDescription to 50 instead of unlimitted.
9
by: Michel Racicot | last post by:
In some language, it's possible to specify a "predefined" size for string objects. Exemple: string which is a string of 10 characters. Is it possible to do this in C#? Thank you
2
by: leo.hou | last post by:
Hi experts, I am new to linux and all the type definitions are driving me mad. What is the best way to check a type definition in linux? When I use man page to check some function definition, I...
5
by: Gary Townsend | last post by:
I have been working on a way to take a datatable from a dataset and transform it into a Geography Markup Language(GML) stream so it can be loaded into another component. The problem i'm finding is...
2
by: Torben Laursen | last post by:
I have a problem with showing text in a richtextbox I want to show 3 columns of data and want them to be aligned. I make sure each string for each column is the same length but since different...
1
by: breal | last post by:
Forgive me for this question which is most likely stupid... How do I determine the number of bytes a string takes up? I have a soap server that is returning a serialized string. It seems that...
3
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post by:
Hi, Can anyone explain me the easiet way to get the size of a folder, including all files subfolders and. Something like DirectoryInfo.Size, helas, its not there. regards Jesper.
6
by: Marcolino | last post by:
Hi all, I have a simple problem but I don't know which is the best way to solve it. I need to savo into a table into access DB the location and the size of a form. Is there a way to save...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.