Windows Develop Bookmark and Share   
 index > Windows Forms General > Print Vertical Text
 

Print Vertical Text

Hi,

How can I Draw on a graphics vertical text?

I have a label with vertical text (from bottom up -NOT like the StringFormatFlags.DirectionVertical)

I can paint it on some graphics but I have the main graphics with all my controls and I want to add it there for printing.

Is anyone familier with that?

Thanks

Idit

Idit  Wednesday, June 13, 2007 5:00 AM
I made a mistake with the code.

e.Graphics.DrawString(str, this.Font, new SolidBrush(this.ForeColor), 0, 0);

Should be:

e.Graphics.DrawString(new_str, this.Font, new SolidBrush(this.ForeColor), 0, 0);

Ðãvę Âņđęŕŝőŋ1  Wednesday, June 13, 2007 5:10 PM
Here is how to draw a verticle string.

string str =
"Hello World!";
string new_str = null;

foreach (char c in str)
{
new_str += c + "\r\n";
}

e.Graphics.DrawString(str, this.Font, new SolidBrush(this.ForeColor), 0, 0);

Things to take note about: the DrawString() method shown uses the default font so it matches the font used for everything else on your object. It also uses the same ForeColor. The last two parameters are the (x, y) cordanates that the string will be drawn at.
Ðãvę Âņđęŕŝőŋ1  Wednesday, June 13, 2007 5:16 AM

Hi,

This will draw a horizontal String (the regular style).

I want to draw a string bottom - up.

Thanks

Idit  Wednesday, June 13, 2007 2:08 PM
If you have the label with the text the way you want it, why can't you position the label where you want it on your form?
JohnWein  Wednesday, June 13, 2007 3:43 PM
I made a mistake with the code.

e.Graphics.DrawString(str, this.Font, new SolidBrush(this.ForeColor), 0, 0);

Should be:

e.Graphics.DrawString(new_str, this.Font, new SolidBrush(this.ForeColor), 0, 0);

Ðãvę Âņđęŕŝőŋ1  Wednesday, June 13, 2007 5:10 PM

You can use google to search for other answers

Custom Search

More Threads

• Control Suites
• Windows forms play avi
• how autolaunch Windows Defragmenter at a particular time
• Remote SQL Server
• How to capture and discard a keystroke character ?
• Text Editor - Display Line Numbers for different font sizes
• How do I accomplish this task
• MDI Help
• how to synchronously open Windows Forms / or how to provide a second UI-Thread without creating a new Application
• Set Rich Text box Text Particular length