Exemple #1
0
        public ColorSlider(ColorSliderMode colorMode, ColorSliderOrientation orientation)
        {
            _colorMode   = colorMode;
            _orientation = orientation;

            _baseColor    = new ColorHLS(255, 255, 0, 0);
            _currentColor = _baseColor.Clone();
            _previusColor = _baseColor.Clone();

            this.SetStyle(
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.FixedHeight |
                ControlStyles.FixedWidth |
                ControlStyles.OptimizedDoubleBuffer |
                ControlStyles.UserPaint,
                true);

            if (_orientation == ColorSliderOrientation.Vertical)
            {
                this.Size   = new System.Drawing.Size(20, 256);
                _cursorRect = new Rectangle(0, 256 - 4, 20, 7);
            }
            else
            {
                this.Size   = new System.Drawing.Size(256, 20);
                _cursorRect = new Rectangle(-3, 0, 7, 20);
            }


            _onDrag = false;

            //_pixBuffer = new PixelBuffer(this.Width, this.Height);
            //FillBuffer();

            this.Invalidate();
        }
Exemple #2
0
        public ColorSlider(ColorSliderMode colorMode,ColorSliderOrientation orientation)
        {
            _colorMode = colorMode;
            _orientation = orientation;

            _baseColor = new ColorHLS(255, 255, 0, 0);
            _currentColor = _baseColor.Clone();
            _previusColor = _baseColor.Clone();

            this.SetStyle(
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.FixedHeight |
                ControlStyles.FixedWidth |
                ControlStyles.OptimizedDoubleBuffer |
                ControlStyles.UserPaint,
                true);

            if (_orientation == ColorSliderOrientation.Vertical)
            {
                this.Size = new System.Drawing.Size(20, 256);
                _cursorRect = new Rectangle(0, 256 - 4, 20, 7);
            }
            else
            {
                this.Size = new System.Drawing.Size(256, 20);
                _cursorRect = new Rectangle(- 3,0 , 7, 20);
            }

            
            _onDrag = false;

            //_pixBuffer = new PixelBuffer(this.Width, this.Height);
            //FillBuffer();

            this.Invalidate();
        }