如何在开始菜单中将我自己的应用程序置于顶部? [英] How can I make my own application on top in the start menu?

查看:106
本文介绍了如何在开始菜单中将我自己的应用程序置于顶部?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用C#语言(.net4.0)编写一个小型桌面应用程序(wpf主窗体).IDE:vs2013;



我希望有我的应用程序位于开始菜单的顶部(Windows 10)。



请查看截面我想要的小应用程序。



我尝试过:



1.申请必须要求uiAccess(app.manifest)

2.应用程序必须断言最顶层窗口定位(在Win32 / SetWindowPos或WinForms / WPF的Topmost属性中,以编程方式或其他方式)

3.无需更改组策略设置,它必须安装到一些受信任的位置[C:\ Windows,C:\Program Files,C:\Program Files(x86)]。

解决方案

< blockquote>据我所知,你不能在Windows 10的开始菜单顶部有一个TopMost窗口。



我没有的应用程序显示在开始菜单的顶部。

xaml的代码:

 <   pre  >  <   Window     x:Class   =   WpfTopmost.MainWindow  

xmlns = http://schemas.microsoft.com/winfx/2006/xaml/presentation

xmlns:x = http://schemas.microsoft.com/winfx / 2006 / xaml

WindowStyle =

AllowTransparency = True

已加载 = Window_Loaded

背景 = 透明

标题 = MainWindow 高度 = 130 宽度 = 130 >
< 网格 背景 = 透明 >
< Ellipse 填充 = 透明 笔划 = 绿色 StrokeThickness = 3 > < / Ellipse >
< / Grid >
< / Window >







xaml.cs的代码:

  private   void  Window_Loaded( object  sender,RoutedEventArgs e)
{
try
{
Thread globalThread = new Thread((ThreadStart)委托
{
MouseStopTimeSpan();
});
globalThread.IsBackground = true ;
globalThread.Start();

}
catch (例外情况)
{
MessageBox.Show(ex.ToString() );
}
}





  private   void  MouseStopTimeSpan()
{
try
{

while true
{
尝试
{
Thread.Sleep( 2 );
lock (_ thisLock)
{
this .Dispatcher.Invoke ( new 行动(()= >
{

.Topmost = false ;
// Thread.Sleep(2);
this .Topmost = true ;

}), null );
}
}
catch (Exception ex)
{

MessageBox.Show( ex.Message);
}

}
}
catch (例外情况)
{

MessageBox.Show(ex.Message);
}
}


I write a small desktop application (wpf main form) in the C# language (.net4.0).IDE:vs2013;

And i want to have my application in top of the start menu (Windows 10).

See screenshot what i want for my small application.

What I have tried:

1.The application must demand uiAccess (app.manifest)
2.The application must assert "topmost" window positioning (either in Win32/SetWindowPos or WinForms/WPF’s "Topmost" property, programmatically or otherwise)
3.Without making changes to the group policy setting, it must be installed to some trusted location [C:\Windows, C:\Program Files, C:\Program Files (x86)].

解决方案

As far as I know, you can't have a window TopMost over the top of the start menu in Windows 10.

Apps that I have don't show up over the top of start menu either.


the code of xaml:

<pre><Window x:Class="WpfTopmost.MainWindow"

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        WindowStyle="None"

        AllowsTransparency="True"

        Loaded="Window_Loaded"

        Background="Transparent"

        Title="MainWindow" Height="130" Width="130">
    <Grid  Background="Transparent">
        <Ellipse Fill="Transparent" Stroke="Green" StrokeThickness="3"></Ellipse>
    </Grid>
</Window>




the code of xaml.cs:

private void Window_Loaded(object sender, RoutedEventArgs e)
{
    try
     {
       Thread globalThread = new Thread((ThreadStart)delegate
                {
                    MouseStopTimeSpan();
                });
                globalThread.IsBackground = true;
                globalThread.Start();

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
}



private void MouseStopTimeSpan()
        {
            try
            {

                while (true)
                {
                    try
                    {
                        Thread.Sleep(2);
                        lock (_thisLock)
                        {
                            this.Dispatcher.Invoke(new Action(() =>
                            {
                               
                                this.Topmost = false;
                                //Thread.Sleep(2);
                                this.Topmost = true;
                               
                            }), null);
                        }
                    }
                    catch (Exception ex)
                    {

                        MessageBox.Show(ex.Message);
                    }

                }
            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message);
            }
        }


这篇关于如何在开始菜单中将我自己的应用程序置于顶部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆