要这么复杂吗?
FromBorderStyle=None;然后再设大小、位置等。
例如:Width=1024 Height=768 Left=0 Top=0
我的是vs.net正式版 + winxp pro.

解决方案 »

  1.   

    我使用的是windows XP,+ VS.NET beta2,按照以下方法做就行不通.(还是有任务栏).再提一个附带问题.如何获取windows 的当前屏幕尺寸?(也就是屏幕右下角的坐标)
    FromBorderStyle=None;然后再设大小、位置等。
    例如:Width=1024 Height=768 Left=0 Top=0
      

  2.   

    我又试了一次,可以。相信这是正式版改动了的地方,因为印象中,我在bate2的时候我是试过的,没有全屏。
    关于获取windows 的当前屏幕尺寸,我见过的,又忘记了。记得才告诉你吧。隐藏任务栏的api:
    FindWindow("Shell_traywnd","")找到任务栏hwnd
    用SetWindowsPos(hwnd,0,0,0,0,0,SWP_HIDEWINDOWS)隐藏
    用SetWindowsPos(hwnd,0,0,0,0,0,SWP_SHOWWINDOW)显示
      

  3.   

    cforce()我只剩下100多分了。你说的算。可以都给你。
    交个朋友
      

  4.   

    按上面的方法可以获得全屏效果,但没有“无论是否设置了“将任务栏保持在其他窗口的前端”都不显示任务栏”效果。代码要点如下:
    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;
      

  5.   

    如果你想更精确地控制taskbar,给你推荐几个关键API消息和函数:(代码就不写了)
    1、ABM_GETSTATE消息可获取taskbar的状态。
    2、ABM_SETSTATE消息可设置taskbar的状态。
    3、ABN_STATECHANGE消息响应taskbar的状态变化。
    4、使用SetWindowPos设置窗口大小位置使窗口全屏显示。要更好地使用全屏,请使用DirectX
      

  6.   

    using System;
    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);
    }
    }
    }
      

  7.   

    我知道了一个更加短小的实现代码!
    只要修改窗体的属性如下就可以了。(要在正式版下才行得通)
    this.FormBorderStyle=System.Windows.Forms.FormBorderStyle.None;
    this.WindowState=System.Windows.Forms.FormWindowState.Maximized;