Draw line and move it programmatically

前端 未结 2 2051
無奈伤痛
無奈伤痛 2021-02-09 13:14

I want to draw a line on a WPF Grid.

private void InitializeTestline()
{
    testline = new Line();
    grid.Children.Add(testline);
    testline.X1 = 0;
    tes         


        
2条回答
  •  醉梦人生
    2021-02-09 13:29

    I was doing this same basic thing only on a maze, and this is what i would do

    private void Move_Up Click(object sender, RoutedEventArgs e)
    {
      Point testlinelocation;
      testlinelocation = testline.Y1;
      testlinelocation.Offset(someX, someY);
      testlinelocation = testline.Y1;
    }
    

    This should work, it worked for me, best of luck This is in winforms

提交回复
热议问题