473,396 Members | 2,023 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,396 software developers and data experts.

ev.graphics

max
Is there a method in the Graphic to wrap a string into a rectangle?
If so is there a way to specify the width and let a Graphics method
determine how much vertical space is required? I tried using
..MeasureString but get weird numbers for the width and height.
({System.Drawing.SizeF}
Empty: {System.Drawing.SizeF}
Height: 21.248373
IsEmpty: False
Width: 40.8447266)

The SizeF I used for the layout rect was
Dim layoutSize As New SizeF(500.0F, 0.0F)

Thanks,
--max
Nov 21 '05 #1
3 1189
<max> schrieb im Newsbeitrag
news:37********************************@4ax.com...
Is there a method in the Graphic to wrap a string into a rectangle?
Have you had a look at all the overloaded DrawString methods? One does what
you need.
If so is there a way to specify the width and let a Graphics method
determine how much vertical space is required? I tried using
.MeasureString but get weird numbers for the width and height.
({System.Drawing.SizeF}
Empty: {System.Drawing.SizeF}
Height: 21.248373
IsEmpty: False
Width: 40.8447266)

The SizeF I used for the layout rect was
Dim layoutSize As New SizeF(500.0F, 0.0F)

Why are these values weired? We don't know the string you measured.

BTW, there's a specialized group for these questions:
microsoft.public.dotnet.framework.drawing
Armin


Nov 21 '05 #2
max
Thanks for the lead to the correct group.

-max

On Wed, 17 Aug 2005 10:12:53 +0200, "Armin Zingler"
<az*******@freenet.de> wrote:
<max> schrieb im Newsbeitrag
news:37********************************@4ax.com.. .
Is there a method in the Graphic to wrap a string into a rectangle?


Have you had a look at all the overloaded DrawString methods? One does what
you need.
If so is there a way to specify the width and let a Graphics method
determine how much vertical space is required? I tried using
.MeasureString but get weird numbers for the width and height.
({System.Drawing.SizeF}
Empty: {System.Drawing.SizeF}
Height: 21.248373
IsEmpty: False
Width: 40.8447266)

The SizeF I used for the layout rect was
Dim layoutSize As New SizeF(500.0F, 0.0F)

Why are these values weired? We don't know the string you measured.

BTW, there's a specialized group for these questions:
microsoft.public.dotnet.framework.drawing
Armin


Nov 21 '05 #3
Try

Dim sz As SizeF = gph.MeasureString(myString, MyFont, Width, MyStringFormat)

'sz will be returned with the height needed based on the string, width, and
alignment you want.

--
Dennis in Houston
"max" wrote:
Thanks for the lead to the correct group.

-max

On Wed, 17 Aug 2005 10:12:53 +0200, "Armin Zingler"
<az*******@freenet.de> wrote:
<max> schrieb im Newsbeitrag
news:37********************************@4ax.com.. .
Is there a method in the Graphic to wrap a string into a rectangle?


Have you had a look at all the overloaded DrawString methods? One does what
you need.
If so is there a way to specify the width and let a Graphics method
determine how much vertical space is required? I tried using
.MeasureString but get weird numbers for the width and height.
({System.Drawing.SizeF}
Empty: {System.Drawing.SizeF}
Height: 21.248373
IsEmpty: False
Width: 40.8447266)

The SizeF I used for the layout rect was
Dim layoutSize As New SizeF(500.0F, 0.0F)

Why are these values weired? We don't know the string you measured.

BTW, there's a specialized group for these questions:
microsoft.public.dotnet.framework.drawing
Armin


Nov 21 '05 #4

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

Similar topics

2
by: JBiagio | last post by:
Hello All, I am attempting to learn a bit about the GDI+ transforms and charting data and I feel like I'm getting a handle on how the transforms work. My chart object has a large "canvas" bitmap...
12
by: Sanjay | last post by:
hi, We are currently porting our project from VB6 to VB .NET. Earlier we used to make scale transformations on objects like pictureBox , forms etc.Now Such transformations are made on the...
2
by: John Bailo | last post by:
I am walking through some of the very first sample code from the book "Beginning .NET Game Programming" from Apress. I identify his sample code with //SC This code puzzles me: Graphics graph...
14
by: Pmb | last post by:
At the moment I'm using Borland's C++ (http://www.borland.com/products/downloads/download_cbuilder.html#) I want to be able to take an array of points and plot them on the screen. Is there a way...
5
by: Charles A. Lackman | last post by:
Hello, I have created a complete PrintDocument and need to create an image from it. How is this done? e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality...
6
by: Chris Dunaway | last post by:
The method for printing documents in .Net can be confusing, especially for newer users. I would like to create a way to simplify this process. My idea would be implemented using a PrintDocument...
12
by: Xah Lee | last post by:
Of Interest: Introduction to 3D Graphics Programing http://xahlee.org/3d/index.html Currently, this introduction introduces you to the graphics format of Mathematica, and two Java Applet...
6
by: active | last post by:
I have an image and a graphics object created (FromImage) from that image. I need to create a new image and create a new graphics object from the new image. I want the new graphics object have...
9
by: DaveL | last post by:
hello I have a Bit map 1367 wide 32 high this bitmap contains like 40 separate Images 32x32 I tell it the id*32 to get the approiate Image from the source Bitmap When i CreateGraphics()...
8
by: Abhiraj Chauhan | last post by:
I need someone to make an example of how to create a graphics window in VB.net 2008. I understand the basics of how to draw a rectangle and lines etc. What I need is an example of how to make a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.