473,396 Members | 1,966 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.

gdi+ drawstring

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 font size , bold / underline attributes are
different.
Nov 20 '05 #1
5 5017
The DrawStirng funcition can be used like this
e.DrawString(font,brush,x,y)
If you want to write diffrent font ,I can give you a
example .

e.DrawStirng("System",myBrushI,100,100)
e.DrawString("Times New Roman",myBrushII,200,200)
then you can see two diffrent font .
ps: myBrushI&myBrushII is the brush varible you can
identify in front to the codes.

Nov 20 '05 #2
To my knowledge, this isn't possible with a single method call. You could
work out a scheme where you combine drawstring calls and measurestring
measurecharacterranges to update the positionals, but this could be more
work than its worth depending on what your goal is.

You might want to try your question in
microsoft.public.dotnet.framework.drawing and see if someone has already
worked out an algorithm to this effect. Some excellent GDI+ gurus hang out
there.

--

Justin Weinberg
Designing a PrintDocument? Drawing to forms?
Check out GDI+ Architect at www.mrgsoft.com
"jack" <an*******@discussions.microsoft.com> wrote in message
news:00****************************@phx.gbl...
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 font size , bold / underline attributes are
different.

Nov 20 '05 #3
The only way you can do this is to parse the RTF and format it yourself. Not
an easy task.

--
Bob Powell [MVP]
C#, System.Drawing

The October edition of Well Formed is now available.
Find out how to use DirectX in a Windows Forms control
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

"jack" <an*******@discussions.microsoft.com> wrote in message
news:00****************************@phx.gbl...
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 font size , bold / underline attributes are
different.

Nov 20 '05 #4
"jack" <an*******@discussions.microsoft.com> schrieb
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 font size , bold / underline attributes are
different.


(I think) GDI+ can not recognize the RTF string. Maybe somebody knows the
answer in the more appropriate group
microsoft.public.dotnet.framework.drawing.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5
* "jack" <an*******@discussions.microsoft.com> scripsit:
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 font size , bold / underline attributes are
different.


That's not supported by GDI+ directly, you will have to change the font
style "by hand" every time it changes in the RTF code. Why don't use a
RichTextBox to display RTF formatted text?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
Nov 20 '05 #6

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

Similar topics

1
by: DrDevious | last post by:
Maybe I am doing something wrong but has anyone else here noticed a difference in the positioning of text between the Graphics.DrawString method and the Win32 GDI DrawText function? My text is...
3
by: Tommy Lang | last post by:
Hi, I need some help. I am trying to draw cards. I am using DrawRectagle() to draw upp the outlining of the card. Then I fill the card with white color FillRectangle(). Then with DrawString I can...
3
by: Richard | last post by:
I have a requirement to put a GDI style circle or rectangle border around the selected row of a datagrid/ It will overlap into the row above and below the selected row. Doing this in a the OnPaint...
2
by: Alphonse Giambrone | last post by:
I am currently reading 'Programming The Web with Visual Basic .NET' and have so far found it to be excellent. Downloaded all the code from Apress and working in chapter 4, I get the error shown...
0
by: Ervin | last post by:
Hi All, I've got a small program that allows you to write text to the front of a postcard, and send it to someone. It works fine for about 10-15 requests, then it just hangs. Specifically, it...
7
by: Peter Row | last post by:
Hi, I've started work on my own control some parts of which use standard controls, others I need to draw on my controls surface to get the display output I require, however.... I seem to be...
0
by: James Wong | last post by:
Hi everybody, I'm facing a serious trouble relating to GDI+ generic error. The error message is "A Generic error occured in GDI+" and the following information is stored in Excepton object:...
14
by: James Wong | last post by:
Hi everybody, I'm facing a serious trouble relating to GDI+ generic error. The error message is "A Generic error occured in GDI+" and the following information is stored in Excepton object:...
5
by: Jonathan Boivin | last post by:
Hi, I've got some problems with loading bills using a bill usercontrol I built. If I load all current bills in my test environment (156) everything is fine once, but repeating the operation...
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
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
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...
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.