在启动任务栏上覆盖全屏C#应用程序
我使用VisualStudio编写了一个Kiosk风格的C#应用程序,它在启动时运行,应该扩展到全屏并覆盖任务栏 我正在做的是将boarder样式设置为none,并填充范围,如果我只是手动启动应用程序,它将非常有效 当应用程序在启动时启动时(通过“开始”菜单中“启动”文件夹中的快捷方式),任务栏最终位于程序顶部,单击表单上的某个位置不会使表单返回顶部在启动任务栏上覆盖全屏C#应用程序,c#,winforms,taskbar,C#,Winforms,Taskbar,我使用VisualStudio编写了一个Kiosk风格的C#应用程序,它在启动时运行,应该扩展到全屏并覆盖任务栏 我正在做的是将boarder样式设置为none,并填充范围,如果我只是手动启动应用程序,它将非常有效 当应用程序在启动时启动时(通过“开始”菜单中“启动”文件夹中的快捷方式),任务栏最终位于程序顶部,单击表单上的某个位置不会使表单返回顶部 以前是否有人遇到过此问题,或者知道可能的解决方法。解决方法:启动时,杀死explorer.exe-您不需要它->任务栏消失。 需要时,使用任务管理
以前是否有人遇到过此问题,或者知道可能的解决方法。解决方法:启动时,杀死
explorer.exe
-您不需要它->任务栏消失。
需要时,使用任务管理器启动它我在另一次也这样做了:
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;
}
}
我想你是这个意思
现在我看到这篇文章是从2013年开始的…不确定,但可能有其他程序中断了它。这是在windows XP的干净安装上。我记不起是什么版本,唯一安装的是.net可分发的和一些USBCAN适配器的驱动程序。你使用什么技术?WPF还是WinForms?我正在使用WinForms进行此项目如果它是windows窗体应用程序,那么这应该会有所帮助:在显示完全打开的窗体之前,是否有一种简单的方法来检查资源管理器是否已完全打开?你能说得更具体一点吗?在任务栏中显示完全打开,这样当窗体启动时,它将正确覆盖任务栏。为此,我将在几周内无法测试它,但它看起来很好,而且是一个非常直接的解决方案,我现在投了赞成票,在我有机会解决这个问题后,我会被认为是正确的。
screensize.Maximize(this)