ZengCode.Com (The Thai Php Framework)  


Home   Download   Manual   About us    

Facebook   


MAIN MENU
News
Php Tips
Android Programming
Design Pattern By PHP
C# using Linq น่าใช้จริงๆ
C# Tips & Technique
C# Design Pattern
Linux Quick Tips
Java & JavaScript Tips
Database & SQL
ZengCode Framework Guide
Zeng Code Code
Programming
IPhone (Tips and Trick)

Download เอกสารที่น่าสนใจ

     How to make a form full-screen in C#   (2010-03-11)

เรามาสร้าง Form ให้ เต็ม หน้าจอกันเถอะครับ

 [DllImport("user32.dll")]
        private static extern int FindWindow(string lpszClassName, string lpszWindowName);
        [DllImport("user32.dll")]
        private static extern int ShowWindow(int hWnd, int nCmdShow);
        private const int SW_HIDE = 0;
        private const int SW_SHOW = 1;

       

        public void FullScreen()
        {
            Screen currentScreen = Screen.FromRectangle(this.RectangleToScreen(ClientRectangle));

            // code to maximize form fullscreen mode  
            if (currentScreen.Primary)
            {
                int hWnd = FindWindow("Shell_TrayWnd", "");
                ShowWindow(hWnd, SW_HIDE);
                this.FormBorderStyle = FormBorderStyle.None;
                this.Location = new Point(0, 0);
                this.WindowState = FormWindowState.Maximized;
            }
            else
            {
                this.FormBorderStyle = FormBorderStyle.None;
                this.Location = new Point(currentScreen.Bounds.X, currentScreen.Bounds.Y);
                this.WindowState = FormWindowState.Maximized;
            }
        }

        public void NormalScreen()
        {
            Screen currentScreen = Screen.FromRectangle(this.RectangleToScreen(ClientRectangle));
            this.FormBorderStyle = FormBorderStyle.Sizable;
            if (currentScreen.Primary)
            {
                //show the hidden task bar  
                int hwnd = FindWindow("Shell_TrayWnd", "");
                ShowWindow(hwnd, SW_SHOW);
            }
            this.WindowState = FormWindowState.Maximized;  
        }

 


Comment
Name
Comment
Security CodeCAPTCHA Image

easy tracking
avis car rental discount code

This page took 0.050153 seconds to load.