程序全屏幕黑色的方法?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsApplication12
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public const int HWND_NOTOPMOST= -2;
public const int SWP_SHOWWINDOW=0x0040;
[DllImport("user32.dll")]
private static extern IntPtr FindWindowEx(int hwnd2, int hWnd2, string lpsz1, string lpsz2);
[DllImport("user32.dll")]
private static extern int GetWindowLong (IntPtr hwnd, int nIndex);
[DllImport("user32.dll")]
private static extern int SetWindowPos(IntPtr hwnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags);
private void Form1_Load(object sender, EventArgs e)
{
IntPtr test = FindWindowEx(0, 0, "Shell_TrayWnd", "");
Console.WriteLine(test.ToString());
int test5 = SetWindowPos(test, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW);
this.TopMost = true;
this.FormBorderStyle = FormBorderStyle.None;
this.Width=Screen.PrimaryScreen.Bounds.Width;
this.Height=Screen.PrimaryScreen.Bounds.Height;
this.Top = 0;
this.Left = 0;
}
}
}
自已在窗體上加panel放你要放的東西,再計算一下居中顯示就行了