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

String length to Pixels

hello all,

I am trying to "draw" a string onto a graphic

Dim pGraphics As System.Drawing.Graphics
pGraphics.DrawString(TheText, drawFont, drawBrush, 100, 100)

but I need to find out the Length of the string in pixels so that I can auto
place it correctly in the picture (instead of using 100,100).

Anyone know how to get the size of a text string in pixels.

Thanks
Brad
Nov 21 '05 #1
2 8165
Hi,

Take a look at the graphics class measurestring method.

http://msdn.microsoft.com/library/de...tringtopic.asp

Ken
------------------
"Brad" <Br**@discussions.microsoft.com> wrote in message
news:AF**********************************@microsof t.com...
hello all,

I am trying to "draw" a string onto a graphic

Dim pGraphics As System.Drawing.Graphics
pGraphics.DrawString(TheText, drawFont, drawBrush, 100, 100)

but I need to find out the Length of the string in pixels so that I can auto
place it correctly in the picture (instead of using 100,100).

Anyone know how to get the size of a text string in pixels.

Thanks
Brad
Nov 21 '05 #2
Hi,
Is Graphics.MeasureString() what you are looking for?

"Brad" <Br**@discussions.microsoft.com> wrote in message
news:AF**********************************@microsof t.com...
hello all,

I am trying to "draw" a string onto a graphic

Dim pGraphics As System.Drawing.Graphics
pGraphics.DrawString(TheText, drawFont, drawBrush, 100, 100)

but I need to find out the Length of the string in pixels so that I can auto
place it correctly in the picture (instead of using 100,100).

Anyone know how to get the size of a text string in pixels.

Thanks
Brad
Nov 21 '05 #3

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

Similar topics

0
by: Chris Lambacher | last post by:
Hi, I have to do some data manipulation that needs to be fast. I had a generator approach (that was faster than a list approch) which was taking approximately 5 seconds to run both encode and...
1
by: Simon Wigzell | last post by:
I am adapting a javascript pulldown menu system to my dynamic website generator - the arrays that hold the menu items information are read from a database and will be different for different users...
3
by: ofer h | last post by:
hello all i have got a span inside a td of a table. i am trying to clip the string that exceeds the length of the td and then put three dots ("...") after it so it will show that the text was...
2
by: Vishal Gupta | last post by:
Hi, I am trying to resolve the following scenario: We have a text box of fixed width that by default should display only 1 line of text without a scrollbar indicator. If there are multiple...
6
by: Cathie Hagen | last post by:
Hi All, I am trying to work out how to find the string-length in pixels (any units would do at this stage) for my document so I can determine column width. Any ideas? Cathie
4
by: nothix9 | last post by:
Hello guys, Ive been working this for 2 days, I am required to position a string using drawstring but the problem is its dynamic and changes depending on the database or source. A quick fix I thought...
2
jlm699
by: jlm699 | last post by:
This is a simple one guys... I just want the last field of a status bar to adjust based on the length of the text contained within. I was using the example from the wxPython status bar demo where...
1
by: dantz | last post by:
Hi everyone, I have a textbox which is multiline and wordwrap is true. I did not set any scrollbar because I want to show it manually (using different buttons) The textbox will sometimes have...
6
by: aznimah | last post by:
hi, i'm work on image comparison. i'm using the similarity measurement which i need to: 1) convert the image into the binary form since the algorithm that i've use works with binary data for the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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...

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.