1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
public class DrawinCanvas8 : Canvas
{
public DrawinCanvas8()
{
}
protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
{
base.OnRenderSizeChanged(sizeInfo);
Canvas c = new Canvas();
c.SnapsToDevicePixels = true;
c.Height = this.ActualHeight;
c.Width = this.ActualWidth;
c.Background = new SolidColorBrush(Colors.Bisque);
this.Children.Add(c);
for (int x = 0; x < 5000; x += 2)
{
Line l = new Line();
l.X1 = x;
l.X2 = x;
l.Y1 = 0;
l.Y2 = this.ActualHeight;
l.SnapsToDevicePixels = true;
l.Stroke = new SolidColorBrush(Colors.Black);
l.StrokeThickness = 1;
c.Children.Add(l);
}
Canvas.SetLeft(c, 0);
}
public void Toto()
{
double d = Canvas.GetLeft(this.Children[0]);
Canvas.SetLeft(this.Children[0], d - 1);
}
} |
Partager