Profile Picture

why can't a remove the fill from a polygon?

Posted By Hans Henrik Friis Pedersen... 10 Years Ago
Author
Message
Hans Henrik Friis Pedersen...
Problem Posted 10 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 28, Visits: 136
Hi,
I would like to have no fill in a polygon and the only way I can find is to use this:

NPointF[] points2 = new NPointF[]
{
    new NPointF(150,140),
    new NPointF(200,140),
    new NPointF(200,200),
    new NPointF(150,200),
};
NPolygonPath cup = new NPolygonPath(points2);
cup.Style.FillStyle = new NColorFillStyle(Color.Empty); // an exception is raised - why?



Nevron Support
Posted 10 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
Hi, the Style property of all diagram elements is by default null. That is why a NullReferenceException is thrown when you try to use a property or method of the Style object. You should always use the static methods of the NStyle class when applying styles to diagram elements in order to avoid such problems. In your case the code should look like this:

NStyle.SetFillStyle(cup, new NColorFillStyle(Color.Empty));


For more information about styles, check out the Styles, Style Composition and Style Sheets documentation topic.

Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic