MainとChildの 2 種類のウィンドウがあります。メインを移動すると、すべての子ウィンドウも移動する必要があります。すべてのウィンドウに styleNone
があるので、 を使用しますDragMove
。子の移動にLocationChange
はMainを使用します。また、メイン ウィンドウをすばやく移動し始めると、子は少し遅れて移動します。私のウィンドウはお互いにくっついているので、メインウィンドウを速く動かすと隙間ができます。この質問を使用します
一度に2つのWPFウィンドウを移動しますか?
このギャップを減らすにはどうすればよいですか?
いくつかのコード:
private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
StickyWindow.ParentWndStartMove(this);
this.DragMove();
}
ここにすべての子を移動します
public static void ParentWndMove(Window parentWindow)
{
for (int i = 0; i < windowsToMove.Length; i++)
{
if (windowsToMove[i])
{
windows[i].Top += -(parentWindowPosition.Y - parentWindow.Top);
windows[i].Left += -(parentWindowPosition.X - parentWindow.Left);
}
}
parentWindowPosition.X = parentWindow.Left;
parentWindowPosition.Y = parentWindow.Top;
}