Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は最初に WPF を使い始めたので、コントロールの場所を変更する方法が問題でした.Margin = new Thickness(...)。
.Margin = new Thickness(...)
古い厚み関数の代わりに、X 軸と Y 軸の制御位置を変更する方法はありますか? また、ボタンが動的に作成されるため、コードでこれが必要です。
例: mybutton というボタンがある場合、その場所を次のように変更するにはどうすればよいですか。
mybutton.X=...; mybutton.Y=...;
このCanvas要素は、X 座標と Y 座標を使用する、私が考えることができる唯一のレイアウト コントロールです。
Canvas
例:
Button button = new Button { Content = "StackOverflow" }; Canvas canvas = new Canvas(); canvas.Children.Add(button); Canvas.SetLeft(button, 100); //X Canvas.SetTop(button, 10); //Y