Win 10 UAP - 画一条线到 Canvas
Win 10 UAP - Drawing a Line to the Canvas
我正在玩 Win 10 UAP 并尝试使用以下代码在 C# 中画一条线到 Canvas 但不起作用。
var line = new Line();
line.Stroke = new SolidColorBrush(Colors.LightSteelBlue);
line.StrokeThickness = 3;
line.Width = 50;
line.X1 = 0;
line.Y1 = 0;
line.X2 = 50;
line.Y2 = 0;
Canvas.SetTop(line, 50);
Canvas.SetLeft(line, 50);
TheCanvas.Children.Add(line);
谁能指出我哪里出错了?
非常感谢,
塔兰
评论此行工作正常:
var line = new Line();
line.Stroke = new SolidColorBrush(Colors.Black);
line.StrokeThickness = 3;
//line.Width = 50;
line.X1 = 0;
line.Y1 = 0;
line.X2 = 50;
line.Y2 = 0;
Canvas.SetTop(line, 50);
Canvas.SetLeft(line, 50);
TheCanvas.Children.Add(line);
我正在玩 Win 10 UAP 并尝试使用以下代码在 C# 中画一条线到 Canvas 但不起作用。
var line = new Line();
line.Stroke = new SolidColorBrush(Colors.LightSteelBlue);
line.StrokeThickness = 3;
line.Width = 50;
line.X1 = 0;
line.Y1 = 0;
line.X2 = 50;
line.Y2 = 0;
Canvas.SetTop(line, 50);
Canvas.SetLeft(line, 50);
TheCanvas.Children.Add(line);
谁能指出我哪里出错了?
非常感谢, 塔兰
评论此行工作正常:
var line = new Line();
line.Stroke = new SolidColorBrush(Colors.Black);
line.StrokeThickness = 3;
//line.Width = 50;
line.X1 = 0;
line.Y1 = 0;
line.X2 = 50;
line.Y2 = 0;
Canvas.SetTop(line, 50);
Canvas.SetLeft(line, 50);
TheCanvas.Children.Add(line);