Kaydol:
Kayıt Yorumları
(
Atom
)
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; namespace c_sharp_formu_tam_ekran_yapma { public partial class Form1 : Form { private System.Windows.Forms.Button btnTamEkranYap; private System.Windows.Forms.Button btnBasliksizTamEkranYap; public Form1() { InitializeComponent(); } [DllImport("user32.dll")] private static extern int FindWindow(string className, string windowText); [DllImport("user32.dll")] private static extern int ShowWindow(int hwnd, int command); //window task barı gizler private const int HIDE = 0; //window task barı gösterir private const int SHOW = 1; private void btnTamEkranYap_Click(object sender, EventArgs e) { //formu tam ekran yapmak için pencere handle ını bulalım int hwnd = FindWindow("Shell_TrayWnd", ""); //window task bar görünür ShowWindow(hwnd, SHOW); //Formun başlığı sabit this.FormBorderStyle = FormBorderStyle.FixedDialog; this.Size = new Size(SystemInformation.VirtualScreen.Width, SystemInformation.VirtualScreen.Height + this.Height - this.ClientSize.Height); CenterToScreen(); } private void btnBasliksizTamEkranYap_Click(object sender, EventArgs e) { //formu tam ekran yapmak için pencereyi bul int hwnd = FindWindow("Shell_TrayWnd", ""); //window task bar görünür ShowWindow(hwnd, SHOW); //formun başlığı yok this.FormBorderStyle = FormBorderStyle.None; //pencereyi boyutunu tam ekran olacak şekilde ayarlayalım this.Size = new Size(SystemInformation.VirtualScreen.Width, SystemInformation.VirtualScreen.Height + this.Height - this.ClientSize.Height); //form penceresini ekranda ortalayalım CenterToScreen(); } private void btnTamEkranYapToolbarGizli_Click(object sender, EventArgs e) { //form pencresini bulalım (handle) int hwnd = FindWindow("Shell_TrayWnd", ""); //window task bar gizli olacak ShowWindow(hwnd, HIDE); //Formun başlığı sabit olsun this.FormBorderStyle = FormBorderStyle.FixedDialog; //pencereyi boyutunu tam ekran olacak şekilde ayarlayalım this.Size = new Size(SystemInformation.VirtualScreen.Width, SystemInformation.VirtualScreen.Height + this.Height - this.ClientSize.Height); //form penceresini ekranda ortalayalım CenterToScreen(); } private void btnBasliksizTamEkranYapToolBArGizli_Click(object sender, EventArgs e) { ////form pencresini bulalım (handle) int hwnd = FindWindow("Shell_TrayWnd", ""); //window task bar gizli olacak ShowWindow(hwnd, HIDE); //formun başlığı olmasın this.FormBorderStyle = FormBorderStyle.None; //pencereyi boyutunu tam ekran olacak şekilde ayarlayalım this.Size = new Size(SystemInformation.VirtualScreen.Width, SystemInformation.VirtualScreen.Height + this.Height - this.ClientSize.Height); //form penceresini ekranda ortalayalım CenterToScreen(); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { //form pencresini kapatırken toolbar görünmez yapılmışsa //masaüstünü kullanmak için tekrar görünür yapalım //Bu uygulama kapanırken toolbar gizli ise int hwnd = FindWindow("Shell_TrayWnd", ""); //gizli olan toolbar görünür yapma ShowWindow(hwnd, SHOW); } } }
Hiç yorum yok :
Yorum Gönder