ClientSize是指工作区的大小。
你用Size就对了。

解决方案 »

  1.   

    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;namespace BMT
    {
    /// <summary>
    /// Summary description for Form1.
    /// </summary>
    public class Form1 : System.Windows.Forms.Form
    {
    /// <summary>
    /// Required designer variable.
    /// </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.AllowDrop = true;
    this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
    this.ClientSize = new System.Drawing.Size(32, 32);
    this.ControlBox = false;
    this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
    this.Location = new System.Drawing.Point(5, 5);
    this.Name = "Form1";
    this.ShowInTaskbar = false;
    this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
    this.TopMost = true;
    this.DragOver += new System.Windows.Forms.DragEventHandler(this.Form1_DragOver);
    this.Deactivate += new System.EventHandler(this.Form1_Deactivate); }
    #endregion /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main() 
    {
    Application.Run(new Form1());
    } private void Form1_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
    {
    MessageBox.Show((string)e.Data.GetData(DataFormats.StringFormat,true));
    } private void Form1_Deactivate(object sender, System.EventArgs e)
    {
    this.BringToFront();
    }
    }
    }这个,就是我代码。依然不是正方形的。郁闷。
      

  2.   

    this.ClientSize = new System.Drawing.Size(32, 32);
    更改为
    this.Size = new System.Drawing.Size(32, 32);
    依然。