473,322 Members | 1,431 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,322 software developers and data experts.

Another GDI+ question

Given a string, the font, fontstyle and fontsize how do i calculate the
rectangle that will hold it ?

thanks.
Nov 15 '05 #1
5 1482

"Karthik Seetharaman" <vz******@nospam.verizon.net> wrote in message
news:J1*******************@nwrddc01.gnilink.net...
Given a string, the font, fontstyle and fontsize how do i calculate the
rectangle that will hold it ?

Use the method 'Graphics.MeasureString', for a given graphics object
context.
Nov 15 '05 #2

"Karthik Seetharaman" <vz******@nospam.verizon.net> wrote in message
news:J1*******************@nwrddc01.gnilink.net...
Given a string, the font, fontstyle and fontsize how do i calculate the
rectangle that will hold it ?

Use the method 'Graphics.MeasureString', for a given graphics object
context.
Nov 15 '05 #3
hOSAM wrote:
"Karthik Seetharaman" <vz******@nospam.verizon.net> wrote in message
news:J1*******************@nwrddc01.gnilink.net...
Given a string, the font, fontstyle and fontsize how do i calculate the
rectangle that will hold it ?


Use the method 'Graphics.MeasureString', for a given graphics object
context.

Thanks. Can i figure out the font-size for a string given the
measurements where it is supposed to go ? I have a rectangular area the
width and height of which is fixed. I need t fit some strings in to that
area.
Nov 15 '05 #4
hOSAM wrote:
"Karthik Seetharaman" <vz******@nospam.verizon.net> wrote in message
news:J1*******************@nwrddc01.gnilink.net...
Given a string, the font, fontstyle and fontsize how do i calculate the
rectangle that will hold it ?


Use the method 'Graphics.MeasureString', for a given graphics object
context.

Thanks. Can i figure out the font-size for a string given the
measurements where it is supposed to go ? I have a rectangular area the
width and height of which is fixed. I need t fit some strings in to that
area.
Nov 15 '05 #5
Hello Karthik,

Check out the StringFormat class in GDI+ which can be used in DrawString
GDI+ function.

Regards,
Sujith.

"Karthik Seetharaman" <vz******@nospam.verizon.net> wrote in message
news:lB*******************@nwrddc02.gnilink.net...
hOSAM wrote:
"Karthik Seetharaman" <vz******@nospam.verizon.net> wrote in message
news:J1*******************@nwrddc01.gnilink.net...
Given a string, the font, fontstyle and fontsize how do i calculate the
rectangle that will hold it ?


Use the method 'Graphics.MeasureString', for a given graphics object
context.

Thanks. Can i figure out the font-size for a string given the
measurements where it is supposed to go ? I have a rectangular area the
width and height of which is fixed. I need t fit some strings in to that
area.

Nov 15 '05 #6

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

Similar topics

1
by: pei_world | last post by:
Hi there, I have a problem about how to keep my draw graphics stay on my control unless I delete them. that means how to resist my graphics. also how to partially remove some graphics from my...
1
by: David Sobey | last post by:
Hi I'm making a custom component using GDI+, a calendar grid thingy. I paint the grid and numbers in my overrided OnPaint. However, when i go to paint other things at other times in other...
2
by: Brian Basquille | last post by:
Another question for ye all.. How do i check if a Region has entered another region? Up until now, i've been checking if rectangles (or images converted into Rectangles) have been visible in a...
7
by: | last post by:
We create VC++ programs that does some GDI drawing functionality. I discovered GDI+ and this seems to be a big step forward, and appears to be standard available in Windows XP and Windows Server...
5
by: jack | last post by:
In using GDI+ drawstring, if the string to be drawn is in rtf format, how do I make GDI+ to recognize the rtf attributes. In other words, how do I draw one string in GDI+ , within which the...
13
by: lgbjr | last post by:
Hello All, I have some pictureboxes on a VB.NET form that are linked to an AccessDB. If the user wishes to open or edit an image, I need to save the image in the picturebox to a temp file, then...
2
by: SStory | last post by:
Question #1) If I do Image.Save with the same filepath that I got the image from, it bombs with "A generic error occurred in GDI+" Any ideas? I prompt the user before overwriting, but if they...
9
by: davetelling | last post by:
I am not a programmer, I'm an engineer trying to make an interface to a product I'm designing. I have used C# to make a form that interrogates the unit via the serial port and receives the data. I...
1
by: Chris Dunaway | last post by:
When working with GDI+, calling the CreateGraphics method to draw on a control has normally been frowned upon and it is always emphasized to dispose of pens and brushes and other GDI objects lest...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.