Skip to main content
Home Forums Silverlight Programming Game Development Polygon scaling
2 replies. Latest Post by Grey Matter on October 15, 2009.
(0)
Grey Matter
Member
39 points
108 Posts
10-13-2009 12:06 PM |
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.Points = new Point(polygon.Points.X * 2, polygon.Points.Y * 2); pos += "(" + polygon.Points.X + ", " + polygon.Points.Y + ")"; } tbPoints.Text = pos; btnScale.Content = (++_counter).ToString(); }}
10-13-2009 12:18 PM |
I see the forum parser makes strange effect too:
10-15-2009 1:32 AM |
I've made another post about this question that may be more clear: