コード例 #1
0
        private void SetColorFromLocationInRect(Point pnt)
        {
            float x = (float)pnt.X / this.pictureBox1.Width;
            float y = (float)pnt.Y / this.pictureBox1.Height;

            x = Math.Min(1, Math.Max(0, x));
            y = Math.Min(1, Math.Max(0, y));

            Endogine.ColorEx.ColorBase clr = this.ColorObject;
            Endogine.Vector4           v   = clr.Vector;

            int posX, posY;

            this.GetXYIndices(out posX, out posY);
            v[posX]                       = x;
            v[posY]                       = 1f - y;
            clr.Vector                    = v;
            this._colorObject             = clr;
            this.colorSlider1.ColorObject = clr;

            //this.ColorObject = clr;
            this.pictureBox1.Invalidate();

            if (this.ColorChanged != null)
            {
                this.ColorChanged(this, null);
            }
        }
コード例 #2
0
        public ColorPickerMulti()
        {
            InitializeComponent();

            this._colorObject = new Endogine.ColorEx.ColorHsb(1, 1, 1, 1);

            this.CreateIndicator();
            this.CreateCanvas();
        }
コード例 #3
0
        public ColorPickerMulti()
        {
            InitializeComponent();

            this._colorObject = new Endogine.ColorEx.ColorHsb(1, 1, 1, 1);

            this.CreateIndicator();
            this.CreateCanvas();
        }
コード例 #4
0
ファイル: ColorSlider.cs プロジェクト: timdetering/Endogine
        public ColorSlider()
        {
            InitializeComponent();

            Bitmap bmp = new Bitmap(1, 100, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            _canvas = Endogine.BitmapHelpers.Canvas.Create(bmp);

            this._colorObject = new Endogine.ColorEx.ColorHsb();
            this._colorObject.Vector = new Endogine.Vector4(1, 1, 1, 1);

            this.DrawBackground();
        }
コード例 #5
0
ファイル: ColorSlider.cs プロジェクト: timdetering/Endogine
        public ColorSlider()
        {
            InitializeComponent();

            Bitmap bmp = new Bitmap(1, 100, System.Drawing.Imaging.PixelFormat.Format24bppRgb);

            _canvas = Endogine.BitmapHelpers.Canvas.Create(bmp);

            this._colorObject        = new Endogine.ColorEx.ColorHsb();
            this._colorObject.Vector = new Endogine.Vector4(1, 1, 1, 1);

            this.DrawBackground();
        }
コード例 #6
0
        private void SetColorFromLocationInRect(Point pnt)
        {
            float x = (float)pnt.X / this.pictureBox1.Width;
            float y = (float)pnt.Y / this.pictureBox1.Height;
            x = Math.Min(1, Math.Max(0, x));
            y = Math.Min(1, Math.Max(0, y));

            Endogine.ColorEx.ColorBase clr = this.ColorObject;
            Endogine.Vector4 v = clr.Vector;

            int posX, posY;
            this.GetXYIndices(out posX, out posY);
            v[posX] = x;
            v[posY] = 1f - y;
            clr.Vector = v;
            this._colorObject = clr;
            this.colorSlider1.ColorObject = clr;

            //this.ColorObject = clr;
            this.pictureBox1.Invalidate();

            if (this.ColorChanged != null)
                this.ColorChanged(this, null);
        }