Skip to main content

Microsoft Silverlight

Answered Question Polygon scalingRSS Feed

(0)

Grey Matter
Grey Matter

Member

Member

39 points

108 Posts

Polygon scaling

 Now I'm trying to implement a map which is using vector data and I ran into a strange effect while scaling polygons. When polygons become very large their strokes start being distorted in various ways. I made a little example but it couldn't get the same strange effect. Anyway you'll be able to see another strange effect if you press the button about 20 times. I would like to know how to avoid this effect or to at least to know why it happens?

Here is the example:

XAML:

  

<Grid x:Name="LayoutRoot">
<Polygon x:Name="polygon" Points="0,0,1,0,1,1" Stroke="Red" Fill="Blue" StrokeThickness="1" />
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock x:Name="tbPoints" Foreground="Black" />
<Button x:Name="btnScale" Click="btnScale_Click" Content="0" />
</StackPanel>
</Grid>

C#:

 

public partial class MainPage : UserControl
{
static int _counter = 0;

public MainPage()
{
InitializeComponent();

}

private void btnScale_Click(object sender, RoutedEventArgs e)
{
string pos = "";
for (int i = 0; i < polygon.Points.Count; i++)
{
polygon.PointsIdea = new Point(polygon.PointsIdea.X * 2, polygon.PointsIdea.Y * 2);
pos += "(" + polygon.PointsIdea.X + ", " + polygon.PointsIdea.Y + ")";
}

tbPoints.Text = pos;
btnScale.Content = (++_counter).ToString();
}
}
  

 

 

 

 

Grey Matter
Grey Matter

Member

Member

39 points

108 Posts

Re: Polygon scaling

 I see the forum parser makes strange effect too: Idea

Grey Matter
Grey Matter

Member

Member

39 points

108 Posts

Answered Question

Re: Polygon scaling

 I've made another post about this question that may be more clear:

 

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities