コード例 #1
0
        protected virtual void SetColour(Point point)
        {
            double    dx;
            double    dy;
            double    angle;
            double    distance;
            double    saturation;
            Padding   padding;
            HSLColour newColour;

            padding    = this.Padding;
            dx         = Math.Abs(point.X - _centerPoint.X - padding.Left);
            dy         = Math.Abs(point.Y - _centerPoint.Y - padding.Top);
            angle      = Math.Atan(dy / dx) / Math.PI * 180;
            distance   = Math.Pow(Math.Pow(dx, 2) + Math.Pow(dy, 2), 0.5);
            saturation = distance / _radius;

            if (point.X < _centerPoint.X)
            {
                angle = 180 - angle;
            }

            if (point.Y > _centerPoint.Y)
            {
                angle = 360 - angle;
            }

            newColour = new HSLColour(angle, saturation, 0.5);

            if (_hslColour != newColour)
            {
                _lockUpdates   = true;
                this.HSLColour = newColour;
                this.Colour    = _hslColour.ToRgbColour();
                _lockUpdates   = false;
            }
        }
コード例 #2
0
 protected void PaintColour(PaintEventArgs e, HSLColour colour)
 {
     this.PaintColour(e, colour, false);
 }