Pertanyaan Aplikasi C # Layar penuh


Bagaimana saya bisa membuat aplikasi C # Windows Forms layar penuh di Visual Studio Express 2010? saya telah mencoba Link ini, tapi itu hanya menunjukkan http://pixpipeline.com/d/57a8554712e8.png


9
2017-11-12 19:49


asal


Jawaban:


Tidak diperlukan trik khusus. Set properti FormBorderStyle ke None, WindowState ke Dimaksimalkan.


13
2017-11-12 19:53



http://www.vesic.org/english/blog/winforms/full-screen-maximize/ 
Contoh: 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;
    }
}

12
2017-11-12 19:55



Mode Kios adalah kata-kata yang ingin Anda gunakan untuk pencarian.

form.MaximizeBox = false;
form.MinimizeBox = false;
form.TopMost = true;
form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
form.WindowState = System.Windows.Forms.FormWindowState.Maximized;

4
2017-11-12 20:00



Dalam properti bentuk set 'Window state' hingga 'Maksimalisasi' (https://i.stack.imgur.com/UfCvY.jpg)


1
2018-06-14 08:56



Untuk membuat aplikasi layar penuh, Anda harus melakukan sesuatu seperti ini ...

this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;

ini adalah nama formulir.


0
2017-11-22 07:17