WPF Always On Top

后端 未结 6 1369
孤街浪徒
孤街浪徒 2020-11-30 00:10

Is it possible to make a window stay always on top even when other application is running on Fullscreen? I\'m using right now TopMost = true but when other appl

6条回答
  •  醉酒成梦
    2020-11-30 01:10

    Try this solution from MSDN, it should work for you. In the Window Activated Event add the following code:

    this.Width   = System.Windows.SystemParameters.PrimaryScreenWidth;
    this.Height  = System.Windows.SystemParameters.PrimaryScreenHeight;
    this.Topmost = true;
    this.Top  = 0;
    this.Left = 0;
    

    in DeActivated Event add the following code

    this.Topmost = true;
    this.Activate();
    

    Original post from MSDN

提交回复
热议问题