码迷,mamicode.com
首页 > Windows程序 > 详细

WPF:窗体置顶

时间:2016-05-10 18:48:38      阅读:1109      评论:0      收藏:0      [点我收藏+]

标签:

1、设置窗体TopMost属性

技术分享
private DispatcherTimer timer;

public Window1()
{
    InitializeComponent();
    Loaded += new RoutedEventHandler(Window1_Loaded);
}
 
void Window1_Loaded(object sender, RoutedEventArgs e)
{
    timer = new DispatcherTimer();
    timer.Interval = TimeSpan.FromSeconds(1);
    timer.Tick += timer1_Tick;
    timer.Start();  

  //....

  //timer.Stop();
}
 
private void timer1_Tick(object sender, EventArgs e)
{
    //定时处理

  this.TopMost = true;
}
View Code

2、设置窗体Owner

技术分享
WindowInteropHelper mianHanel = new WindowInteropHelper(MainWindow.Current);
WindowInteropHelper vedioWin = new WindowInteropHelper(this);
WindowInteropHelper FrameWin = new WindowInteropHelper(FrameWindow);
FrameWin.Owner = IntPtr.Zero;
mianHanel.Owner = vedioWin.Handle;
vedioWin.Owner = FrameWin.Handle; 
View Code

3、

WPF:窗体置顶

标签:

原文地址:http://www.cnblogs.com/shenchao/p/5478559.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!