예제 #1
0
        protected virtual void BasePanel_MouseDown(object sender, MouseEventArgs e)
        {
            //Console.WriteLine("down width={0},height={1},left={2},top={3},({4},{5})",
            //       this.Width, this.Height, this.Left, this.Top, e.X, e.Y);

            isDown       = true;
            point_down.X = e.X;
            point_down.Y = e.Y;

            if (e.X >= -padding && e.X < const_width - padding && //拽左上角
                e.Y >= -padding && e.Y < const_height - padding)
            {
                mDownOnType = DownOnType.LeftTop;
            }
            else if (e.X >= this.Width - const_width - padding && e.X <= this.Width + padding && //拽右上角
                     e.Y >= -padding && e.Y <= const_height)
            {
                mDownOnType = DownOnType.RightTop;
            }
            else if (e.X >= -padding && e.X < const_width - padding && //拽左下角
                     e.Y >= this.Height - const_height && e.Y <= this.Height)
            {
                mDownOnType = DownOnType.LeftBottom;
            }
            else if (e.X >= this.Width - const_width - padding && e.X <= this.Width + padding && //拽右下角
                     e.Y >= this.Height - const_height && e.Y <= this.Height)
            {
                mDownOnType = DownOnType.RightBottom;
            }
            else if (e.X >= (this.Width - const_width) / 2 && e.X <= (this.Width + const_width) / 2 && //拽中上
                     e.Y >= -padding && e.Y <= const_height)
            {
                mDownOnType = DownOnType.TopMid;
            }
            else if (e.X >= -padding && e.X < const_width - padding &&
                     e.Y >= (this.Height - const_height) / 2 && e.Y <= (this.Height + const_height) / 2)  //拽中左
            {
                mDownOnType = DownOnType.LeftMid;
            }
            else if (e.X >= this.Width - const_width - padding && e.X <= this.Width + padding &&
                     e.Y >= (this.Height - const_height) / 2 && e.Y <= (this.Height + const_height) / 2) //拽中右
            {
                mDownOnType = DownOnType.RightMid;
            }
            else if (e.X >= (this.Width - const_width) / 2 && e.X <= (this.Width + const_width) / 2 &&
                     e.Y >= this.Height - const_height && e.Y <= this.Height) //拽中下
            {
                mDownOnType = DownOnType.BottomMid;
            }
            else
            {
                mDownOnType = DownOnType.Normal;
            }
        }
예제 #2
0
 protected virtual void BasePanel_MouseUp(object sender, MouseEventArgs e)
 {
     //Console.WriteLine("up width={0},height={1},left={2},top={3},({4},{5})",
     //       this.Width, this.Height, this.Left, this.Top, e.X, e.Y);
     isDown      = false;
     mDownOnType = DownOnType.Normal;
     if (m_onNodeSelectedDelegate != null)
     {
         properties.Properties[androidView.layout_width]  = this.Width;
         properties.Properties[androidView.layout_height] = this.Height;
         m_onNodeSelectedDelegate(this, properties);
     }
     // mDragTip.Visible = false;
 }