下面是使用窗体透明性创建下规则代码using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication10
{
    public partial class Form1 : Form
    {
        private Point lastPoint = Point.Empty;
        public Form1()
        {
            InitializeComponent();
            pictureBox1.MouseDown += new MouseEventHandler(OnMouseDown);
            pictureBox1.MouseUp += new MouseEventHandler(OnMouseUp);
            pictureBox1.MouseMove += new MouseEventHandler(OnMouseMove);        }        private void Form1_Load(object sender, EventArgs e)
        {
            
        }        private void MouseDown(object sender, MouseEventArgs e)
        {
            lastPoint.X = e.X;
            lastPoint.Y = e.Y;
        }        private void MouseUp(object sender, MouseEventArgs e)
        {
            lastPoint = Point.Empty;
        }        private void MouseMove(object sender, MouseEventArgs e)
        {
            if (lastPoint != Point.Empty)
            {
                int xInc = e.X - lastPoint.X;
                int yInc = e.Y - lastPoint.Y;
                this.Location = new Point(this.Left + xInc, this.Top + yInc);
            }
        }        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
错误提示警告 1 “WindowsApplication10.Form1.MouseDown(object, System.Windows.Forms.MouseEventArgs)”隐藏了继承的成员“System.Windows.Forms.Control.MouseDown”。如果是有意隐藏,请使用关键字 new。 C:\Documents and Settings\user\My Documents\Visual Studio 2005\Projects\WindowsApplication10\WindowsApplication10\Form1.cs 27 22 WindowsApplication10
警告 2 “WindowsApplication10.Form1.MouseUp(object, System.Windows.Forms.MouseEventArgs)”隐藏了继承的成员“System.Windows.Forms.Control.MouseUp”。如果是有意隐藏,请使用关键字 new。 C:\Documents and Settings\user\My Documents\Visual Studio 2005\Projects\WindowsApplication10\WindowsApplication10\Form1.cs 33 22 WindowsApplication10
警告 3 “WindowsApplication10.Form1.MouseMove(object, System.Windows.Forms.MouseEventArgs)”隐藏了继承的成员“System.Windows.Forms.Control.MouseMove”。如果是有意隐藏,请使用关键字 new。 C:\Documents and Settings\user\My Documents\Visual Studio 2005\Projects\WindowsApplication10\WindowsApplication10\Form1.cs 38 22 WindowsApplication10
错误 4 “OnMouseDown”的重载均与委托“System.Windows.Forms.MouseEventHandler”不匹配 C:\Documents and Settings\user\My Documents\Visual Studio 2005\Projects\WindowsApplication10\WindowsApplication10\Form1.cs 16 38 WindowsApplication10
错误 5 “OnMouseUp”的重载均与委托“System.Windows.Forms.MouseEventHandler”不匹配 C:\Documents and Settings\user\My Documents\Visual Studio 2005\Projects\WindowsApplication10\WindowsApplication10\Form1.cs 17 36 WindowsApplication10
错误 6 “OnMouseMove”的重载均与委托“System.Windows.Forms.MouseEventHandler”不匹配 C:\Documents and Settings\user\My Documents\Visual Studio 2005\Projects\WindowsApplication10\WindowsApplication10\Form1.cs 18 38 WindowsApplication10

解决方案 »

  1.   

    MouseDown,MouseUp,MouseMove和Form的三个事件同名了!
    你要改个名字就行了!
      

  2.   

    如果确实想隐藏,请用new关键字..for example:private new void MouseMove(object sender, MouseEventArgs e)...如果不是,那就换个名字..for example:MouseMove->> MyMouseMove..
      

  3.   

    大哥名字改了不行啊
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    namespace WindowsApplication10
    {
        public partial class Form1 : Form
        {
            private Point lastPoint = Point.Empty;
            public Form1()
            {
                InitializeComponent();
                pictureBox1.MouseDown += new MouseEventHandler(OnMouseDown);
                pictureBox1.MouseUp += new MouseEventHandler(OnMouseUp);
                pictureBox1.MouseMove += new MouseEventHandler(OnMouseMove);        }        private void Form1_Load(object sender, EventArgs e)
            {
                
            }        private void MyMouseDown(object sender, MouseEventArgs e)
            {
                lastPoint.X = e.X;
                lastPoint.Y = e.Y;
            }        private void MyMouseUp(object sender, MouseEventArgs e)
            {
                lastPoint = Point.Empty;
            }        private void MyMouseMove(object sender, MouseEventArgs e)
            {
                if (lastPoint != Point.Empty)
                {
                    int xInc = e.X - lastPoint.X;
                    int yInc = e.Y - lastPoint.Y;
                    this.Location = new Point(this.Left + xInc, this.Top + yInc);
                }
            }        private void button1_Click(object sender, EventArgs e)
            {
                this.Close();
            }
        }
    }
    错误错误 1 “OnMouseDown”的重载均与委托“System.Windows.Forms.MouseEventHandler”不匹配 C:\Documents and Settings\user\My Documents\Visual Studio 2005\Projects\WindowsApplication10\WindowsApplication10\Form1.cs 16 38 WindowsApplication10
    错误 3 “OnMouseMove”的重载均与委托“System.Windows.Forms.MouseEventHandler”不匹配 C:\Documents and Settings\user\My Documents\Visual Studio 2005\Projects\WindowsApplication10\WindowsApplication10\Form1.cs 18 38 WindowsApplication10
    错误 2 “OnMouseUp”的重载均与委托“System.Windows.Forms.MouseEventHandler”不匹配 C:\Documents and Settings\user\My Documents\Visual Studio 2005\Projects\WindowsApplication10\WindowsApplication10\Form1.cs 17 36 WindowsApplication10
      

  4.   

    try..pictureBox1.MouseDown += new MouseEventHandler(MyMouseDown);
                pictureBox1.MouseUp += new MouseEventHandler(MyMouseUp);
                pictureBox1.MouseMove += new MouseEventHandler(MyMouseMove);