Displaying a polygon
Hi!
In WPF there is a Polygon shape. How to have the same functionality in Noesis? I found the Path class, but cannot figure out how to use it instead of Polygon in my code. Note that I am doing it from C# code, not XAML.
EDIT
I managed to draw a polygon, but it is not filled. My code looks like this:
Thanks!
In WPF there is a Polygon shape. How to have the same functionality in Noesis? I found the Path class, but cannot figure out how to use it instead of Polygon in my code. Note that I am doing it from C# code, not XAML.
EDIT
I managed to draw a polygon, but it is not filled. My code looks like this:
Code: Select all
var result = new Path();
result.SetFill(new SolidColorBrush(Noesis.Color.Yellow));
result.SetStroke(new SolidColorBrush(Noesis.Color.Green));
var streamGeometry = new StreamGeometry();
var context = streamGeometry.Open();
context.BeginFigure(new Point(10, 10), true);
context.LineTo(new Point(10, 40));
context.LineTo(new Point(40, 40));
context.Dispose();
result.SetFill(new SolidColorBrush(Noesis.Color.Yellow));
result.SetData(streamGeometry);
-
sfernandez
Site Admin
- Posts: 3188
- Joined:
Re: Displaying a polygon
I see what is happening... our code does not behave exactly the same as in WPF. In NoesisGUI you have to call StreamGeometry.Close() explicitly when you have finished entering commands in the context, like this:
We will change this for the next release, so Close is automatically called when context gets disposed, as it occurs in WPF
Code: Select all
var streamGeometry = new StreamGeometry();
var context = streamGeometry.Open();
context.BeginFigure(new Point(10, 10), true);
context.LineTo(new Point(10, 40));
context.LineTo(new Point(40, 40));
streamGeometry.Close();
var path = new Path();
path.SetFill(new SolidColorBrush(Noesis.Color.Yellow));
path.SetStroke(new SolidColorBrush(Noesis.Color.Green));
path.SetData(streamGeometry);
Re: Displaying a polygon
Thanks a lot! This helped!I see what is happening... our code does not behave exactly the same as in WPF. In NoesisGUI you have to call StreamGeometry.Close() explicitly when you have finished entering commands in the context, like this:
We will change this for the next release, so Close is automatically called when context gets disposed, as it occurs in WPFCode: Select allvar streamGeometry = new StreamGeometry(); var context = streamGeometry.Open(); context.BeginFigure(new Point(10, 10), true); context.LineTo(new Point(10, 40)); context.LineTo(new Point(40, 40)); streamGeometry.Close(); var path = new Path(); path.SetFill(new SolidColorBrush(Noesis.Color.Yellow)); path.SetStroke(new SolidColorBrush(Noesis.Color.Green)); path.SetData(streamGeometry);
Re: Displaying a polygon
Another problem: The figure is not filled. How can I make it filled?
-
sfernandez
Site Admin
- Posts: 3188
- Joined:
Re: Displaying a polygon
Hi, there is a bug with the StreamGeometryContext, I will fix it for the next release.
Thanks for reporting.
Thanks for reporting.
Re: Displaying a polygon
We fixed this problem in v1.1.4
Who is online
Users browsing this forum: Ahrefs [Bot] and 5 guests