Re: Fill an irregular shape with color
- From: "Bob Powell [MVP]" <bob@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 14 Jun 2006 23:15:22 +0200
Create a new GraphicsPath object and add lines as you like. You can add a
collection of points and create a closed shape such as your map example
using the AddLines method. Similarly you can add rectangles, ellipses and
other shapes.
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"Sergio" <Sergio@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:80C7F0DE-AD0F-45AB-A924-8F56C75D405E@xxxxxxxxxxxxxxxx
Ok, so how do I get the GraphicsPath for the shape? I ask because the
shape
will always be different so I wouldn't be able to predefine the points.
"Bob Powell [MVP]" wrote:
Use a GraphicsPath to contain ther shape as a set of points and fill this
shape with the desired brush using Graphics.FillPath.
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"Sergio" <Sergio@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:2FDF5FD9-51A0-4D73-A51D-8B0779ABF92E@xxxxxxxxxxxxxxxx
Hello,
How do I fill an irregular shape with a given color in an image with
System.Drawing?
Let's say I have a map of North America and I want to paint the USA
with a
color given by my user. It's just like doing a fill with paint or
photoshop
right in the middle of the USA. Is there a way to do this with
System.Drawing?
I just want to know if it's possible and a possible explanation on how
to
do
it. I don't necessarily need the exact code for it.
.
- References:
- Re: Fill an irregular shape with color
- From: Bob Powell [MVP]
- Re: Fill an irregular shape with color
- Prev by Date: Re: A bug with PenAlignment ??
- Next by Date: Performance & new Pen() / new Brush()
- Previous by thread: Re: Fill an irregular shape with color
- Next by thread: A bug with PenAlignment ??
- Index(es):
Relevant Pages
|