0

ウィンドウの配置に問題があります。ウィンドウは私のメインウィンドウではありません。タスクバーの上の作業領域の右下隅にウィンドウを配置したいと考えています。

私は次のコードを持っています:

public partial class NotificationWindow : Window
{
    public NotificationWindow()
    {
        InitializeComponent();
    }

    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        Rect desktopWorkingArea = SystemParameters.WorkArea;
        Left = desktopWorkingArea.Right - Width;
        Top = desktopWorkingArea.Bottom - Height;
    }
}

そして、そのコードの望ましくない結果:

ここに画像の説明を入力

通知ウィンドウをタスクバーの少し上に置きたいです。私のコードは機能するはずですが、機能しません。

アドバイスをありがとう。

4

1 に答える 1

1

私は満足のいく結果でこれを使用しました。

double width = 375;
double height = 275;

Window w = new Window();
w.Width = width;
w.Height = height;
w.Left = SystemParameters.FullPrimaryScreenWidth - width;
w.Top = SystemParameters.FullPrimaryScreenHeight - height;

w.ShowDialog();
于 2016-09-20T09:54:34.630 に答える