Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / March 2008

Tip: Looking for answers? Try searching our database.

GDI and Rotating Text

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
trullock@googlemail.com - 12 Mar 2008 11:46 GMT
Hi,

I want to use GDI to rotate some text at an angle and output the
resultant image to the asp.net response stream.

I can do that all fine, however what I'm struggling with is trimming
the whitespace from the resultant image.

What im doing is creating a blank canvas image (of arbitrarily large
size) and doing a translate transform to the centre, then applying a
rotate transform, then writing my text.

What i want to do is trim all the whitespace from around the edges. Is
there some way i can determine the width and height of the text ive
written to the image (after the transform) ?

I know i can manually get the text dimensions before the rotate, then
use some trig to work out how high and wide it would be after rotating
it but thats a bit of a pain if theres some function that will do it
for me

Thanks for any advice

Andrew
Peter Duniho - 12 Mar 2008 18:31 GMT
> [...]
> What i want to do is trim all the whitespace from around the edges. Is
[quoted text clipped - 5 lines]
> it but thats a bit of a pain if theres some function that will do it
> for me

You wrote that you're transforming the Graphics before drawing to  
accomplish the rotation.  You can also use the Matrix that you've assigned  
to the Graphics.Transform property to transform the rectangle you can  
easily derive from the text measurement methods, by calling  
Matrix.TransformPoints().

Pete

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.