Esempio n. 1
0
        private void ColorGradientChip_MouseMove(object sender, MouseEventArgs e)
        {
            if (this._mouseDrag != null)
            {
                Endogine.EPoint pnt  = new Endogine.EPoint(this.PointToScreen(e.Location));
                Endogine.EPoint diff = pnt - this._mouseDrag;
                this._mouseDrag = pnt;

                //this.Location = (new Endogine.EPoint(this.Location) + diff).ToPoint();
                int left = this.Left + diff.X;
                if (left < 0)
                {
                    left = 0;
                }
                else if (left > this.Parent.Width - this.Width)
                {
                    left = this.Parent.Width - this.Width;
                }
                this.Left              = left;
                this._draggedDistance += diff.ToEPointF().Length;

                this._position = (float)this.Left / (this.Parent.Width - this.Width);

                if (Math.Abs(e.Y) > 20)
                {
                    if (this.Visible)
                    {
                        this.Visible = false;
                    }
                }
                else if (!this.Visible)
                {
                    this.Visible = true;
                }

                if (this.Dragged != null)
                {
                    this.Dragged(this, e);
                }
            }
        }