要这么复杂吗?
FromBorderStyle=None;然后再设大小、位置等。
例如:Width=1024 Height=768 Left=0 Top=0
我的是vs.net正式版 + winxp pro.
FromBorderStyle=None;然后再设大小、位置等。
例如:Width=1024 Height=768 Left=0 Top=0
我的是vs.net正式版 + winxp pro.
调试欢乐多
FromBorderStyle=None;然后再设大小、位置等。
例如:Width=1024 Height=768 Left=0 Top=0
关于获取windows 的当前屏幕尺寸,我见过的,又忘记了。记得才告诉你吧。隐藏任务栏的api:
FindWindow("Shell_traywnd","")找到任务栏hwnd
用SetWindowsPos(hwnd,0,0,0,0,0,SWP_HIDEWINDOWS)隐藏
用SetWindowsPos(hwnd,0,0,0,0,0,SWP_SHOWWINDOW)显示
交个朋友
size sz=SystemInformation.PrimaryMonitorSize;
frm.Height=sz.Height;
frm.Width=sz.Width;
frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
frm.TopMost=true;
this.Location .X=0;
this.Location .Y=0;
1、ABM_GETSTATE消息可获取taskbar的状态。
2、ABM_SETSTATE消息可设置taskbar的状态。
3、ABN_STATECHANGE消息响应taskbar的状态变化。
4、使用SetWindowPos设置窗口大小位置使窗口全屏显示。要更好地使用全屏,请使用DirectX
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;
namespace WindowsApplication2
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
/// <summary>
[DllImport("user32.dll")]
public static extern int FindWindow(
string lpClassName, // class name
string lpWindowName // window name
); [DllImport("user32.dll")]
public static extern bool SetWindowPos(
int hWnd, // handle to window
int hWndInsertAfter, // placement-order handle
int X, // horizontal position
int Y, // vertical position
int cx, // width
int cy, // height
uint uFlags // window-positioning options
); const int SWP_NOSIZE = 0x1;
const int SWP_NOMOVE = 0x2;
const int SWP_NOZORDER = 0x4;
const int SWP_NOREDRAW = 0x8;
const int SWP_NOACTIVATE = 0x10;
const int SWP_FRAMECHANGED = 0x20; // The frame changed: send WM_NCCALCSIZE
const int SWP_SHOWWINDOW = 0x40;
const int SWP_HIDEWINDOW = 0x80;
const int SWP_NOCOPYBITS = 0x100;
const int SWP_NOOWNERZORDER = 0x200; // Don't do owner Z ordering const int SWP_DRAWFRAME = SWP_FRAMECHANGED;
const int SWP_NOREPOSITION = SWP_NOOWNERZORDER; // SetWindowPos() hwndInsertAfter values
const int HWND_TOP = 0;
const int HWND_BOTTOM = 1;
const int HWND_TOPMOST = -1;
const int HWND_NOTOPMOST = -2;
private int hTaskBar;
/// </summary>
private System.ComponentModel.Container components = null; public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
} /// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
//
// Form1
//
this.Size=SystemInformation.PrimaryMonitorSize;
this.hTaskBar=FindWindow("Shell_traywnd",null);
this.Name = "Form1";
this.Text = "Form1";
this.Closing += new System.ComponentModel.CancelEventHandler(this.Form1_Closing);
this.Load += new System.EventHandler(this.Form1_Load);
}
#endregion /// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
} private void Form1_Load(object sender, System.EventArgs e)
{
SetWindowPos(this.hTaskBar,HWND_BOTTOM,0,0,0,0,SWP_HIDEWINDOW);
} private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
SetWindowPos(this.hTaskBar,HWND_TOP,0,0,0,0,SWP_SHOWWINDOW);
}
}
}
只要修改窗体的属性如下就可以了。(要在正式版下才行得通)
this.FormBorderStyle=System.Windows.Forms.FormBorderStyle.None;
this.WindowState=System.Windows.Forms.FormWindowState.Maximized;