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

change text orientation

Does anyone know how to put text on a form (using DrawString or another
method) in a certain angle?
I can only find ways to orientate text vertically or horizontally, but I'd
like to display a string in an angle of 30 or 45 degrees...
Nov 15 '05 #1
4 7813
> I can only find ways to orientate text vertically or horizontally, but I'd
like to display a string in an angle of 30 or 45 degrees...


use RotateTransform method of a Graphics object.

Regards,
Wiktor
Nov 15 '05 #2
Thanks a lot.
Now I have the following problem:

objGraphics.DrawString(tekst, objFont, objBrush,x1,y1);

puts my string on (x1,y1), but when I put

objGraphics.RotateTransform(30);
objGraphics.DrawString(tekst, objFont, objBrush,x1,y1);

the string is rotated, but the coördinates don't seem right anymore.

I've tried TranslateTransform with a few different arguments before
RotateTransform because I've seen this in examples, but I don't quite
understand what it does and I can't make it work right.
"Wiktor Zychla" <ie****@microsoft.com.no.spam> wrote in message
news:eE*************@TK2MSFTNGP11.phx.gbl...
I can only find ways to orientate text vertically or horizontally, but I'd like to display a string in an angle of 30 or 45 degrees...


use RotateTransform method of a Graphics object.

Regards,
Wiktor

Nov 15 '05 #3
> Now I have the following problem:

void DrawRotatedString(Graphics g, string text, Font font, Brush br,
Rectangle rect, StringFormat format, float angle)
{
Point center = new Point(rect.X+rect.Width/2,
rect.Y+rect.Height/2);
g.TranslateTransform(center.X, center.Y);
g.RotateTransform(angle);
rect.Offset(-center.X, -center.Y);
g.DrawString(text, font, br, rect, format);
g.ResetTransform(-angle);
}

Nov 15 '05 #4
Thank you very much, Wiktor.

"Wiktor Zychla" <ie****@microsoft.com.no.spam> wrote in message
news:#H**************@TK2MSFTNGP10.phx.gbl...
Now I have the following problem:
void DrawRotatedString(Graphics g, string text, Font font, Brush

br, Rectangle rect, StringFormat format, float angle)
{
Point center = new Point(rect.X+rect.Width/2,
rect.Y+rect.Height/2);
g.TranslateTransform(center.X, center.Y);
g.RotateTransform(angle);
rect.Offset(-center.X, -center.Y);
g.DrawString(text, font, br, rect, format);
g.ResetTransform(-angle);
}

Nov 15 '05 #5

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

Similar topics

7
by: Santah | last post by:
hi I'm new to C++ and I'm currently working on Visual C++ 6.0 I'm trying to open a text file, and read some data from it part of the text file looks like this: --------
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...
4
by: Ronny Sigo | last post by:
Hello all, I am trying to programmatically change the orientation of a MS Word Document to landscape. I must be doing something wrong cause it does not work ... can anybody help me with this?...
1
by: Mehul Gadhia | last post by:
Hi All, If anybody is aware please let me know how do i change the orientation of the toolbar of the .net windows control. When i drag out the toolbar its orientation is horizontal, then once...
3
by: Nevets Steprock | last post by:
I have a webpage that prints nicely when the layout is switched from portrait to landscape. Many of my site users have mistakenly printed it without making the change to their settings and end up...
1
by: SEGACO | last post by:
I need to create a report in a datagrid that displays some data in vertical orientation, for example STATE CITY Florida Miami Florida Miami Florida Miami that only Florida...
5
by: Stan McCann | last post by:
Is there a way, or does anyone know if maybe in CSS3, there is a plan to implement vertical rotated text? At http://alamo.nmsu.edu/roundup/schedule.html, in the information I was provided,...
1
by: PCB | last post by:
Hi all! I have a subroutine that prints reports on a specific printer. The code works fine as long as all the printers available to the computer are on the network. However, if the computer also...
3
by: AndyDelbaere | last post by:
Hello, I have a word document with multiple pages. I want to select a random page and be able to change the orientation (from portrait to landscape and vice versa) This should only change the...
0
by: cleary1981 | last post by:
Hi, Heres my xsl stylesheet. Its work in progress but it works. What I want to do however is to make one page in the middle (drawings) a landscape page. Can anyone explain how to do this as all...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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.