Các bạn từng sử dụng IE hay Firefox có thể chuyển sang chế độ full screen khi nhấn phím F11 và trở lại trạng thái cũ khi nhấn F11 lần nữa. Điều này có thể dễ dàng thực hiện được trong lập trình C#
Full screen nhưng vẫn còn taskbar
Mã:
private bool _bFullScreenMode = false;private void Form1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e){ if (e.KeyData == Keys.F11) { if (_bFullScreenMode == false) { this.FormBorderStyle = FormBorderStyle.None; this.Left = 0; this.Top = 0; this.Bounds = Screen.PrimaryScreen.Bounds; _bFullScreenMode = true; } else { this.FormBorderStyle = FormBorderStyle.Sizable; // Resize lại như cũ _bFullScreenMode = false; } }}
Muốn ẩn taskbar và hiện trở lại sử dụng code sau đây:
Mã:
using System;using System.Runtime.InteropServices; [DllImport("User32", EntryPoint = "FindWindow")]private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [DllImport("user32.dll", EntryPoint = "SetWindowPos")]static extern bool SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags); const int SWP_HIDEWINDOW = 0x80;const int SWP_SHOWWINDOW = 0x40; private IntPtr taskbar = FindWindow("Shell_traywnd", ""); public void HideTaskBar(){ SetWindowPos(taskbar, 0, 0, 0, 0, 0, SWP_HIDEWINDOW);} public void ShowTaskbar(){ SetWindowPos(taskbar, 0, 0, 0, 0, 0, SWP_SHOWWINDOW);}
Kết hợp 2 code này sẽ cho ta một màn hình full screen hoàn hảo.
View more random threads:
Ngọc Bích xanh bản chất thuộc dòng đá đá hoa (jade). Và cẩm thạch là tên gọi chung của ngọc bích. Vì thực chất chúng thuộc dòng đá đa khoáng được hình thành từ chất Silicat dưới dạng dioxy. Ngọc bích...
Chia sẻ Vòng tay ngọc bích xanh là...