如何創建一個全屏幕的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. Tkinter全屏應用程序
- 2. PyS60應用程序不會全屏
- 3. 使顫動應用程序全屏
- 4. NSToolbar的全屏應用程序
- 5. 如何把iOS應用程序全屏
- 6. 使讀卡器應用程序全屏?
- 7. 如何繪製全屏應用程序
- 8. 空氣應用程序全屏故障
- 9. 製作全屏可可應用程序
- 10. Mac OSX全屏應用程序問題
- 11. C#Windows Phone應用程序全屏控件
- 12. 可以全屏打開程序的應用程序?
- 13. WPF伸展全屏應用程序來覆蓋整個屏幕
- 14. 如何讓android應用程序屏幕全屏?
- 15. 當屏幕保護程序打開時,全屏java應用程序最小化
- 16. 如何讓我的應用程序停留在全屏應用程序之上
- 17. 在Windows 8中顯示網絡應用程序作爲全屏應用程序
- 18. 全屏應用程序選項(隱藏應用程序標題欄)
- 19. 如何使反應網絡應用程序全屏
- 20. 使用twinview的2臺顯示器上的全屏應用程序Ubuntu 12.04 C++
- 21. $(window).height()不適用於iPad全屏網絡應用程序
- 22. 應用程序不使用屏幕(動作條)的全寬
- 23. 如何禁用HTML5全屏iPhone應用程序中的彈跳?
- 24. 檢測用戶是否有全屏運行的應用程序
- 25. iOS應用程序不使用iPhone上全屏7
- 26. 是否可以使用Phonegap開發全屏iPad應用程序?
- 27. 在iOS中使用鏈接全屏Web應用程序
- 28. 適用於Android的全屏Web應用程序
- 29. C# - 爲什麼不能全屏winform應用程序總是覆蓋任務欄?
- 30. 使用java在全屏幕應用程序中拍攝屏幕截圖?
的可能重複[我怎樣做一個WinForms應用程序全屏顯示(http://stackoverflow.com/questions/505167/how-do-i-make-a-winforms-app-go-full-screen ) – 2010-11-12 20:04:16