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.Pi xels.
/// </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">Th e 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="orientati on">ReadFromLHS Page or ReadFromRHSPage </param>
public void DrawVertText(St ring strText, Font font, Brush brush, float
fX, float fY, VTextROrientati on orientation)
{
StringFormat strf = new
StringFormat(St ringFormatFlags .DirectionVerti cal);
//
// No translation
//
if( orientation == VTextROrientati on.ReadFromLHSP age )
{
graph.DrawStrin g(strText, font, brush, fX, fY, strf);
}
else if( orientation == VTextROrientati on.ReadFromRHSP age )
{
//
// Get size of drawn text in Pixels
//
SizeF sizeText = graph.MeasureSt ring(strText, font, 2000, strf);
int width = Convert.ToInt32 (sizeText.Width );
int height = Convert.ToInt32 (sizeText.Heigh t);
//
// 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.MakeTranspa rent(Color.Whit e);
Graphics grfBmp = Graphics.FromIm age( bmp );
grfBmp.DrawStri ng(strText, font, brush, 0, 0, strf);
bmp.RotateFlip( RotateFlipType. Rotate180FlipNo ne);
//
// Draw the bitmap into the page.
//
Rectangle rect = new Rectangle(Conve rt.ToInt32(fX),
Convert.ToInt32 (fY),
Convert.ToInt32 (sizeText.Width ),
Convert.ToInt32 (sizeText.Heigh t) );
graph.DrawImage (bmp, rect, 0, 0, width , height,
GraphicsUnit.Pi xel);
}
}
"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.publi c.dotnet.framew ork.drawing
Cor