如何创建一个全屏幕的C#Windows在Visual Studio Express的2010窗体应用程序?我试过this link,但它只是显示http://pixpipeline.com/d/57a8554712e8.png全屏C#应用程序
全屏C#应用程序
回答
没有特别的技巧是必要的。将FormBorderStyle属性设置为None,将WindowState设置为Maximized。
http://www.vesic.org/english/blog/winforms/full-screen-maximize/
例子:http://www.vesic.org/blog/upload/MaxWinForm.zip
/// <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 = true;
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;
}
}
得到来自“匿名”人的爱。 :) – 2010-11-12 20:08:27
大概是因为你永远不希望有一个全屏应用程序始终在最前面...... – 2014-05-03 21:20:07
Kiosk mode是您要使用的搜索词。
form.MaximizeBox = false;
form.MinimizeBox = false;
form.TopMost = true;
form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
form.WindowState = System.Windows.Forms.FormWindowState.Maximized;
当“边框”设置为“无”,没有必要禁用最大化和最小化框。当'BorderStyle'为'None'时,整个窗口标题被删除,包括最小化,最大化和关闭框。 – 2010-11-12 22:05:50
很高兴知道,谢谢。 – Lars 2010-11-14 10:56:11
为了让你不得不做这样的事情全屏幕应用程序...
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;
这是形式的名称。
- 1. Windows 8应用程序全屏webview C#
- 2. Tkinter全屏应用程序
- 3. 全屏WP通用应用程序
- 4. 使应用程序弹出一个全屏应用程序
- 5. PyS60应用程序不会全屏
- 6. 如何把iOS应用程序全屏
- 7. Linux桌面全屏应用程序
- 8. Teamviewer和全屏directX应用程序
- 9. 使读卡器应用程序全屏?
- 10. 在Android应用程序全屏视频
- 11. 调整OOB全屏silverlight应用程序
- 12. iOS的Web应用程序,全屏?
- 13. Mac OSX全屏应用程序问题
- 14. 使颤动应用程序全屏
- 15. NSToolbar的全屏应用程序
- 16. QML全屏桌面应用程序
- 17. 制作全屏可可应用程序
- 18. 如何启动全屏应用程序?
- 19. 如何绘制全屏应用程序
- 20. Java Fx全屏应用程序
- 21. JFileChooser在全屏幕Swing应用程序
- 22. Android全屏平板应用程序
- 23. 空气应用程序全屏故障
- 24. C#Windows Phone应用程序全屏控件
- 25. 我的C#应用程序的全屏错误
- 26. 在启动任务栏上覆盖全屏C#应用程序
- 27. 全屏的C程序应用程序不工作在Windows 7/8
- 28. 可以全屏打开程序的应用程序?
- 29. Android - 全屏仅在启动屏幕不在应用程序中
- 30. 运行屏幕/背光的全屏Android应用程序关闭
的可能重复[我怎样做一个WinForms应用程序全屏显示(http://stackoverflow.com/questions/505167/how-do-i-make-a-winforms-app-go-full-screen ) – 2010-11-12 20:04:16