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 / Windows Forms / Drawing / August 2004

GDI+ "drawing areas"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
PhilipZ - 18 Jul 2004 21:29 GMT
Hi there!

I am looking for a possibility to draw e.g. a circle or rectangle with some
text in it (VB.NET and GDI+). The text will be moving, but must never exceed
the edges of the circle/rectangle. So the text should be "cut off" at the
edges of the surrounding circle/rectangle.

Can anyone give me some hints how to achieve this? Would really appreciate
any help!

Thanks in advance!
Phil
James Westgate - 18 Jul 2004 23:02 GMT
Use the drawing2d.GraphicsPath class to draw the shape. Apply a
region to the graphics object using the GraphicsPath to clip the
output eg

//not tested

graphics.DrawRectangle(new Rectangle(500,500,100,60));

graphics.Clip = new Region(graphicsPath);

graphics.DrawString("hello world"); //more parameter options here

James

Signature

Create interactive diagrams and flowcharts with ERM Diagram at

http://www.crainiate.net

Take the ERM Tour at http://www.flowchartcontrol.com

18/07/2004 21:29:44

PhilipZ <papazulu@philweb.at.REMOVE> wrote in message

<upGIJYQbEHA.3204@TK2MSFTNGP09.phx.gbl>

> Hi there!

> I am looking for a possibility to draw e.g. a circle or rectangle with some

> text in it (VB.NET and GDI+). The text will be moving, but must never exceed

> the edges of the circle/rectangle. So the text should be "cut off" at the

> edges of the surrounding circle/rectangle.

> Can anyone give me some hints how to achieve this? Would really appreciate

> any help!

> Thanks in advance!

> Phil
Signature

Composed with Newz Crawler 1.7 http://www.newzcrawler.com/

PhilipZ - 19 Jul 2004 10:57 GMT
Thanks VERY much, James! Seems to be working exactly as required...! ;-))
Phil

> Use the drawing2d.GraphicsPath class to draw the shape. Apply a
> region to the graphics object using the GraphicsPath to clip the
[quoted text clipped - 9 lines]
>
> James
PhilipZ - 19 Jul 2004 14:54 GMT
Thanks again for your help!!

One more question: how can I now draw other things outside of this "clipped"
area? It seems that once I use "graphics.clip" I am unable to draw other
things around this previously drawn clipped object...

Would (once more) appreciate any hints! ;-)

Thanks!
Phil

> Use the drawing2d.GraphicsPath class to draw the shape. Apply a
> region to the graphics object using the GraphicsPath to clip the
[quoted text clipped - 9 lines]
>
> James
James Westgate - 19 Jul 2004 16:21 GMT
Hi,

You need to reset the clip - graphics.ResetClip should do the trick

J

19/07/2004 14:54:50

PhilipZ <papazulu@philweb.at.REMOVE> wrote in message

<erI1JgZbEHA.3204@TK2MSFTNGP09.phx.gbl>

> Thanks again for your help!!

> One more question: how can I now draw other things outside of this "clipped"

> area? It seems that once I use "graphics.clip" I am unable to draw other

> things around this previously drawn clipped object...

> Would (once more) appreciate any hints! ;-)

> Thanks!

> Phil

> "James Westgate" <james.westgate@nospamcrainiate.com> schrieb im Newsbeitrag

> news:uYBl5LRbEHA.1356@TK2MSFTNGP09.phx.gbl...

> > Use the drawing2d.GraphicsPath class to draw the shape. Apply a

> > region to the graphics object using the GraphicsPath to clip the

> > output eg

> > //not tested

> > graphics.DrawRectangle(new Rectangle(500,500,100,60));

> > graphics.Clip = new Region(graphicsPath);

> > graphics.DrawString("hello world"); //more parameter options here

> > James
Signature

Composed with Newz Crawler 1.7 http://www.newzcrawler.com/

PhilipZ - 19 Jul 2004 16:25 GMT
Thanks a MILLION!!! That's just perfect! :-))
Phil

> You need to reset the clip - graphics.ResetClip should do the trick
>
> J
Brian - 25 Aug 2004 06:07 GMT
James could you give a more detailed example in VB.NET? I'm trying to make a
simple windows app that places text within a circle.

> Use the drawing2d.GraphicsPath class to draw the shape. Apply a
> region to the graphics object using the GraphicsPath to clip the
[quoted text clipped - 31 lines]
>
> > Phil

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.