日期:2014-05-20  浏览次数:20789 次

请教问题
下面是使用窗体透明性创建下规则代码

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);