473,503 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1487

"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
1205
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
1689
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
3150
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
2928
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
5024
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
4628
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
1474
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
3160
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
2114
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...
1
6979
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
7449
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
5570
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,...
1
4998
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
4666
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
3160
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
3149
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1498
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 ...
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.