コード例 #1
0
ファイル: ColorPicker.xaml.cs プロジェクト: yarwelp/tooll
        private void UpdateSliders()
        {
            double minSize = Math.Min(XColorCircleThumb.ActualHeight, XColorCircleThumb.ActualWidth);

            XColorTranslateTransform.X = Math.Sin((H + 90) / 180 * Math.PI) * minSize * (float)Math.Pow(S, 0.5) * 0.5f;
            XColorTranslateTransform.Y = Math.Cos((H + 90) / 180 * Math.PI) * minSize * (float)Math.Pow(S, 0.5) * 0.5f;

            XOpacityGradientColor1.Color = UIHelper.ColorFromFloatRGBA(R, G, B, 0.0f);
            XOpacityGradientColor2.Color = UIHelper.ColorFromFloatRGBA(R, G, B, 1.0f);

            RGB brightRgb = RGB.FromHSV(H, S, 1.0f);

            XVSlider.Background = new SolidColorBrush(UIHelper.ColorFromFloatRGBA(brightRgb.R, brightRgb.G, brightRgb.B, 1.0f));
            XVSlider.Background.Freeze();
            if (_EnableTextUpdate)
            {
                _EnableTextUpdate = false;

                XRGBTextBox.Text  = String.Format("{0:X2}{1:X2}{2:X2}", (int)(R * 255), (int)(G * 255), (int)(B * 255));
                _EnableTextUpdate = true;
            }
        }