2013-10-21 57 views
8

我使用visual studio编写了Kiosk风格的C#应用​​程序,该应用程序在启动时运行,并应扩展为全屏并覆盖任务栏。在启动任务栏上覆盖全屏C#应用程序

我正在做通常的设置寄宿生风格为无,并填充范围,它完美的作品,如果我只是手动启动应用程序。

当应用程序启动时(通过启动菜单中的启动文件夹中的快捷方式)启动时,任务栏会在程序顶部结束,并且单击表单上的某处不会显示表单回到顶部。

有没有人遇到过这个问题,或知道可能的解决方法。

+0

不知道,但可能会有o其他程序中断它 – Rohit

+0

这是在Windows XP的干净安装我不记得是什么版本,唯一的东西已经安装的.net可分发和USBCAN适配器的一些驱动程序。 – Hugoagogo

+0

你使用什么技术? WPF或WinForms? – galenus

回答

0

解决方法:启动时,杀死explorer.exe - 您不需要它 - >任务栏消失。 当需要时,使用任务管理器启动

+0

会有一个简单的方法来检查浏览器已完全打开之前显示的形式 – Hugoagogo

+0

完全打开?你可以说得更详细点吗? – Ondrej

+0

完全打开,因为在任务栏正在显示,所以当表格开始时,它会正确覆盖任务栏。 – Hugoagogo

3

我也这样做了另一个时间:

public class Screensize 
{ 
    /// <summary> 
    /// Selected Win AI Function Calls 
    /// </summary> 

    public class WinApi 
    { 
     [DllImport("user32.dll", EntryPoint = "GetSystemMetrics")] 
     public static extern int GetSystemMetrics(int which); 

     [DllImport("user32.dll")] 
     public static extern void 
      SetWindowPos(IntPtr hwnd, IntPtr hwndInsertAfter, 
         int X, int Y, int width, int height, uint flags); 

     private const int SM_CXSCREEN = 0; 
     private const int SM_CYSCREEN = 1; 
     private static IntPtr HWND_TOP = IntPtr.Zero; 
     private const int SWP_SHOWWINDOW = 64; // 0x0040 

     public static int ScreenX 
     { 
      get { return GetSystemMetrics(SM_CXSCREEN); } 
     } 

     public static int ScreenY 
     { 
      get { return GetSystemMetrics(SM_CYSCREEN); } 
     } 

     public static void SetWinFullScreen(IntPtr hwnd) 
     { 
      SetWindowPos(hwnd, HWND_TOP, 0, 0, ScreenX, ScreenY, SWP_SHOWWINDOW); 
     } 
    } 

    /// <summary> 
    /// Class used to preserve/restore state of the form 
    /// </summary> 
    public class FormState 
    { 
     private FormWindowState winState; 
     private FormBorderStyle brdStyle; 
     private bool topMost; 
     private Rectangle bounds; 

     private bool IsMaximized = false; 

     public void Maximize(Form targetForm) 
     { 
      if (!IsMaximized) 
      { 
       IsMaximized = true; 
       Save(targetForm); 
       targetForm.WindowState = FormWindowState.Maximized; 
       targetForm.FormBorderStyle = FormBorderStyle.None; 
       targetForm.TopMost = false; 
       WinApi.SetWinFullScreen(targetForm.Handle); 
      } 
     } 

     public void Save(Form targetForm) 
     { 
      winState = targetForm.WindowState; 
      brdStyle = targetForm.FormBorderStyle; 
      topMost = targetForm.TopMost; 
      bounds = targetForm.Bounds; 
     } 

     public void Restore(Form targetForm) 
     { 
      targetForm.WindowState = winState; 
      targetForm.FormBorderStyle = brdStyle; 
      targetForm.TopMost = topMost; 
      targetForm.Bounds = bounds; 
      IsMaximized = false; 
     } 
    } 

,只是在你的形式调用:

screensize.Maximize(this) 

我想你的意思是这

现在我看到这个帖子是从2013年...

+0

感谢你们,我几个星期不会去测试它,但它看起来既不错,也非常直观,现在UpVote,并且在我有机会解决这个问题之后将标记为正确。 – Hugoagogo

相关问题