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

Vertical and Angled Text

I write software that needs to draw simple engineering drawings for factory
workers to read.

A standard for drawings is to be able to read the text from the bottom right
corner.
The GDI defaults vertical text to be readable from the left side of the page
(upside down). It seems from the news group that many people are having
problems with this.

Additionally we have the need to be able to draw text along an angled line,
we have been able to do this for the last 30 years on Plotters, Laser
printers, Postscript printers, Non-Microsoft Graphic screens, Printer
plotters and our own bit map printer support.

I think it is about time we could draw text directly at any angle from 0 to
360 degress it in the Windows GDI.

Is it possible to do this now and if not how about making it possible ?
Nov 22 '05 #1
4 2631
Philip,

Did you know that this is a typical question for the newsgroup

microsoft.public.dotnet.framework.drawing

Cor
Nov 22 '05 #2
Thanks Cor but I could only find one item in there about this, it was also in
the managed section and had to do with rounding the inches position. I had
already looked through the managed news group as well, most were more related
to controls or using bit maps to get around the problem. This is a fairly
fundemental issue of what can be drawn to a device, it should be supported
directly in the GDI and I am surprised that it is not, when non-Microsoft
inplementors of printers etc.. include this as standard fair. I can get
around it by drawing into a bitmap or metadata and including that in my
drawing but this should not be needed. It should be possible to draw such
basic stuff from the GDI and I am surprised that the GDI does not support
this directly. I was hopeing it was there or to prompt MS to add it.

"Cor Ligthert" wrote:
Philip,

Did you know that this is a typical question for the newsgroup

microsoft.public.dotnet.framework.drawing

Cor

Nov 22 '05 #3
Philip,

It is not my stuff however I have seen questions like yours so often
(although to screen forever). There is a lot of stuff about GDI on MSDN but
mostly hard to find, mabye this link you can use as a start.

http://msdn.microsoft.com/library/de...us/GDIPlus.asp

Cor
Thanks Cor but I could only find one item in there about this, it was also in the managed section and had to do with rounding the inches position. I had
already looked through the managed news group as well, most were more related to controls or using bit maps to get around the problem. This is a fairly
fundemental issue of what can be drawn to a device, it should be supported
directly in the GDI and I am surprised that it is not, when non-Microsoft
inplementors of printers etc.. include this as standard fair. I can get
around it by drawing into a bitmap or metadata and including that in my
drawing but this should not be needed. It should be possible to draw such
basic stuff from the GDI and I am surprised that the GDI does not support
this directly. I was hopeing it was there or to prompt MS to add it.

"Cor Ligthert" wrote:
Philip,

Did you know that this is a typical question for the newsgroup

microsoft.public.dotnet.framework.drawing

Cor

Nov 22 '05 #4
I have done this to work around it in C# GDI+ but I should not have to do
this.
(It ignores Graphics scaling and it makes little bitmaps for the text)

/// <summary>
/// Assumes the graphics device is operating in GraphicsUnit.Pixels.
/// </summary>
/// <param name="strText">The text string to write.</param>
/// <param name="font">The font to be used for this text.</param>
/// <param name="brush">The brush to be used for this text.</param>
/// <param name="fX">The X coordinate in pixels.</param>
/// <param name="fY">The Y coordinate in pixels.</param>
/// <param name="orientation">ReadFromLHSPage or ReadFromRHSPage</param>
public void DrawVertText(String strText, Font font, Brush brush, float
fX, float fY, VTextROrientation orientation)
{
StringFormat strf = new
StringFormat(StringFormatFlags.DirectionVertical);

//
// No translation
//
if( orientation == VTextROrientation.ReadFromLHSPage )
{
graph.DrawString(strText, font, brush, fX, fY, strf);
}
else if( orientation == VTextROrientation.ReadFromRHSPage )
{
//
// Get size of drawn text in Pixels
//
SizeF sizeText = graph.MeasureString(strText, font, 2000, strf);
int width = Convert.ToInt32(sizeText.Width);
int height = Convert.ToInt32(sizeText.Height);

//
// Make a bitmap make it transparent (uses white as transparency
color !)
// draw the string in it
// then flip that image.
//
Bitmap bmp = new Bitmap(width , height);
bmp.MakeTransparent(Color.White);
Graphics grfBmp = Graphics.FromImage( bmp );
grfBmp.DrawString(strText, font, brush, 0, 0, strf);
bmp.RotateFlip(RotateFlipType.Rotate180FlipNone);

//
// Draw the bitmap into the page.
//
Rectangle rect = new Rectangle(Convert.ToInt32(fX),
Convert.ToInt32(fY),
Convert.ToInt32(sizeText.Width),
Convert.ToInt32(sizeText.Height) );
graph.DrawImage(bmp, rect, 0, 0, width , height,
GraphicsUnit.Pixel);
}
}
"Cor Ligthert" wrote:
Philip,

It is not my stuff however I have seen questions like yours so often
(although to screen forever). There is a lot of stuff about GDI on MSDN but
mostly hard to find, mabye this link you can use as a start.

http://msdn.microsoft.com/library/de...us/GDIPlus.asp

Cor
Thanks Cor but I could only find one item in there about this, it was also

in
the managed section and had to do with rounding the inches position. I had
already looked through the managed news group as well, most were more

related
to controls or using bit maps to get around the problem. This is a fairly
fundemental issue of what can be drawn to a device, it should be supported
directly in the GDI and I am surprised that it is not, when non-Microsoft
inplementors of printers etc.. include this as standard fair. I can get
around it by drawing into a bitmap or metadata and including that in my
drawing but this should not be needed. It should be possible to draw such
basic stuff from the GDI and I am surprised that the GDI does not support
this directly. I was hopeing it was there or to prompt MS to add it.

"Cor Ligthert" wrote:
Philip,

Did you know that this is a typical question for the newsgroup

microsoft.public.dotnet.framework.drawing

Cor


Nov 22 '05 #5

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

Similar topics

3
by: kAldam | last post by:
I am currently using IE 6.0 and 5.5 and the scenario is the following. I have a span that contains text, and the span is beign contained by a table cell (this is the way thing need to be in my...
1
by: Kenneth | last post by:
Okay, I've been scouring Google for hours looking for a solution to this problem, but as of yet I can't find one. XHTML Transitional seems to specify that I can no longer set a table's height to...
4
by: Philip K | last post by:
I write software that needs to draw simple engineering drawings for factory workers to read. A standard for drawings is to be able to read the text from the bottom right corner. The GDI...
2
by: Eric Lindsay | last post by:
If I want to have the middle of an image vertically aligned with the middle of a heading (or several lines of heading), is there some particular way people would recommend? vertical-align: center...
5
by: Markus Ernst | last post by:
Hello This is a test example: http://www.markusernst.ch/anthracite/ http://www.markusernst.ch/anthracite/living_divani.html After googling and experimenting for several hours, I ended up...
3
by: acunnon | last post by:
I am trying to put together an login page my problem is getting the three items aligned to the middle verticaly without specifing a height to anything on the page. CSS html{ height:100%;...
2
by: esteuart | last post by:
I need to get the right combination for a div to clip any text inside and allow vertical alignment. I only have this problem in FireFox. I have 3 divs nested within each other. The outer div has...
8
by: ayamopamo | last post by:
Hi- I am trying to center a web page. It seems like this should be very simple to do, but apparently it isn't my day. I have successfully centered the background by calling it in the css body tag:...
40
by: maya | last post by:
hi, how do I get text to vertical-align inside a div? http://www.mayacove.com/misc/home.html vertical-align should work, according to this:...
1
by: Ken Fine | last post by:
Hi, hoping someone can help out with what's a simple question. I am using the ASP.NET VE map control here on a site, which I am still developing. I'm putting picture icons on a map: ...
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...
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.