Пример #1
0
        private void tbColor_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) {
            var cpd = new Microsoft.Samples.CustomControls.ColorPickerDialog();

            cpd.StartingColor = _selectedColor;

            if (cpd.ShowDialog() == true) {
                SelectedColor = cpd.SelectedColor;
            }
        }
        private void ColorButton_Click(object sender, RoutedEventArgs e)
        {
			var player = (Player)((Button)e.Source).DataContext;
			var picker = new Microsoft.Samples.CustomControls.ColorPickerDialog {StartingColor = player.Color, Owner = this };
			var result = picker.ShowDialog();
			if (result == true)
			{
				player.Color = picker.SelectedColor;
			}
        }
Пример #3
0
        /// <summary>
        /// Event handler for when a new point has been created.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void glHost_PointClicked(object sender, PointClickedEventArgs e)
        {
            if (projectstate.EditorState == ProjectState.ProjectEditorState.Color)
            {
                Vector4 vectorColor = Vector4.One;
                if (e.ButtonsPressed == System.Windows.Forms.MouseButtons.Left)
                {
                    vectorColor = e.ClickedPoint.LeftColor;
                }
                else if (e.ButtonsPressed == System.Windows.Forms.MouseButtons.Right)
                {
                    vectorColor = e.ClickedPoint.RightColor;
                }
                else
                {
                    return;
                }

                Microsoft.Samples.CustomControls.ColorPickerDialog cPicker
                    = new Microsoft.Samples.CustomControls.ColorPickerDialog();

                Color color = new Color();
                color.R = (byte)(vectorColor.X * 255);
                color.G = (byte)(vectorColor.Y * 255);
                color.B = (byte)(vectorColor.Z * 255);
                color.A = (byte)(vectorColor.W * 255);

                cPicker.Owner         = this;
                cPicker.StartingColor = color;

                bool?dialogResult = cPicker.ShowDialog();
                if (dialogResult != null && (bool)dialogResult == true)
                {
                    Vector4 selectedVectorColor = new Vector4();
                    Color   selectedColor       = cPicker.SelectedColor;
                    selectedVectorColor.X = selectedColor.R / 255f;
                    selectedVectorColor.Y = selectedColor.G / 255f;
                    selectedVectorColor.Z = selectedColor.B / 255f;
                    selectedVectorColor.W = selectedColor.A / 255f;

                    if (e.ButtonsPressed == System.Windows.Forms.MouseButtons.Left)
                    {
                        e.ClickedPoint.LeftColor = selectedVectorColor;
                    }
                    else if (e.ButtonsPressed == System.Windows.Forms.MouseButtons.Right)
                    {
                        e.ClickedPoint.RightColor = selectedVectorColor;
                    }

                    this.projectstate.Saved = false;
                }

                editorControl.SetIdle();
            }
        }
Пример #4
0
        private void tbColor_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var cpd = new Microsoft.Samples.CustomControls.ColorPickerDialog();

            cpd.StartingColor = _selectedColor;

            if (cpd.ShowDialog() == true)
            {
                SelectedColor = cpd.SelectedColor;
            }
        }
Пример #5
0
        private void ColorButton_Click(object sender, RoutedEventArgs e)
        {
            var player = (Player)((Button)e.Source).DataContext;
            var picker = new Microsoft.Samples.CustomControls.ColorPickerDialog {
                StartingColor = player.Color, Owner = this
            };
            var result = picker.ShowDialog();

            if (result == true)
            {
                player.Color = picker.SelectedColor;
            }
        }
Пример #6
0
        private void SetRecColor(Rectangle fsRec)
        {
            Microsoft.Samples.CustomControls.ColorPickerDialog cPicker
                                  = new Microsoft.Samples.CustomControls.ColorPickerDialog();
            cPicker.Owner         = App.Current.MainWindow;
            cPicker.StartingColor = (fsRec.Fill as SolidColorBrush).Color;

            bool?dialogResult = cPicker.ShowDialog();

            if (dialogResult != null && (bool)dialogResult == true)
            {
                (fsRec.Fill as SolidColorBrush).Color = cPicker.SelectedColor;
            }
        }
        bool updateColor(ref Color color)
        {
            Microsoft.Samples.CustomControls.ColorPickerDialog cPicker
                = new Microsoft.Samples.CustomControls.ColorPickerDialog();
            cPicker.StartingColor = color;
            cPicker.Owner         = this;

            bool?dialogResult = cPicker.ShowDialog();

            if (dialogResult != null && (bool)dialogResult == true)
            {
                color = cPicker.SelectedColor;
                return(true);
            }
            return(false);
        }
        private void SetFill(object sender, RoutedEventArgs e)
        {
            Shape selectedShape = (Shape)GetValue(SelectedShapeProperty);

            Microsoft.Samples.CustomControls.ColorPickerDialog cPicker
                = new Microsoft.Samples.CustomControls.ColorPickerDialog();
            cPicker.StartingColor = FillColor;
            cPicker.Owner         = this;

            bool?dialogResult = cPicker.ShowDialog();

            if (dialogResult != null && (bool)dialogResult == true)
            {
                if (selectedShape != null)
                {
                    selectedShape.Fill = new SolidColorBrush(cPicker.SelectedColor);
                }
                FillColor = cPicker.SelectedColor;
            }
        }
Пример #9
0
        private void BackgroundColorMenuItem_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            Properties.Settings setting = App.Current.Resources["SettingsDataSource"] as Properties.Settings;

            Microsoft.Samples.CustomControls.ColorPickerDialog dialog = new Microsoft.Samples.CustomControls.ColorPickerDialog();
            if (setting != null)
            {
                dialog.StartingColor = setting.backgroundColor.Color;
            }

            dialog.ShowDialog();
            bool? ret = dialog.DialogResult;
            if (ret.HasValue && ret.Value == true)
            {
                if (setting != null)
                {
                    setting.backgroundColor = new SolidColorBrush(dialog.SelectedColor);
                    this.UpdateLayout();
                }
            }
        }
Пример #10
0
        private void BackgroundColorMenuItem_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            Properties.Settings setting = App.Current.Resources["SettingsDataSource"] as Properties.Settings;

            Microsoft.Samples.CustomControls.ColorPickerDialog dialog = new Microsoft.Samples.CustomControls.ColorPickerDialog();
            if (setting != null)
            {
                dialog.StartingColor = setting.backgroundColor.Color;
            }

            dialog.ShowDialog();
            bool?ret = dialog.DialogResult;

            if (ret.HasValue && ret.Value == true)
            {
                if (setting != null)
                {
                    setting.backgroundColor = new SolidColorBrush(dialog.SelectedColor);
                    this.UpdateLayout();
                }
            }
        }
Пример #11
0
        private void SetFill(object sender, RoutedEventArgs e)
        {
            Shape selectedShape = (Shape)GetValue(SelectedShapeProperty);

                Microsoft.Samples.CustomControls.ColorPickerDialog cPicker 
                    = new Microsoft.Samples.CustomControls.ColorPickerDialog();                   
                cPicker.StartingColor = FillColor;
                cPicker.Owner = this;
                
                bool? dialogResult = cPicker.ShowDialog(); 
                if (dialogResult != null && (bool)dialogResult == true)
                {

                    if (selectedShape != null)
                        selectedShape.Fill = new SolidColorBrush(cPicker.SelectedColor);
                    FillColor = cPicker.SelectedColor;
   
                }
                
        }
Пример #12
0
        private void Edit_Color_Click(object sender, RoutedEventArgs e)
        {
            Button btn = sender as Button;

            if (btn != null)
            {
                ColorSettingViewModel csvm = btn.DataContext as ColorSettingViewModel;

                if (csvm != null)
                {
                    Microsoft.Samples.CustomControls.ColorPickerDialog colorDiag = new Microsoft.Samples.CustomControls.ColorPickerDialog();
                    colorDiag.Owner = this;

                    switch (csvm.Name)
                    {
                    case "Offensive Player Color":
                        colorDiag.StartingColor = ColorSetting.Instance.OffensivePlayerColor;
                        if (colorDiag.ShowDialog() == true)
                        {
                            ColorSetting.Instance.OffensivePlayerColor = colorDiag.SelectedColor;
                        }
                        break;

                    case "Defensive Player Color":
                        colorDiag.StartingColor = ColorSetting.Instance.DefensivePlayerColor;
                        if (colorDiag.ShowDialog() == true)
                        {
                            ColorSetting.Instance.DefensivePlayerColor = colorDiag.SelectedColor;
                        }
                        break;

                    case "Route Color":
                        colorDiag.StartingColor = ColorSetting.Instance.RouteColor;
                        if (colorDiag.ShowDialog() == true)
                        {
                            ColorSetting.Instance.RouteColor = colorDiag.SelectedColor;
                        }
                        break;

                    case "Zone Line Color":
                        colorDiag.StartingColor = ColorSetting.Instance.ZoneLineColor;
                        if (colorDiag.ShowDialog() == true)
                        {
                            ColorSetting.Instance.ZoneLineColor = colorDiag.SelectedColor;
                        }
                        break;

                    case "Zone Color":
                        colorDiag.StartingColor = ColorSetting.Instance.ZoneColor;
                        if (colorDiag.ShowDialog() == true)
                        {
                            ColorSetting.Instance.ZoneColor = colorDiag.SelectedColor;
                        }
                        break;

                    case "PreSnapMotion Color":
                        colorDiag.StartingColor = ColorSetting.Instance.PreSnapMotionColor;
                        if (colorDiag.ShowDialog() == true)
                        {
                            ColorSetting.Instance.PreSnapMotionColor = colorDiag.SelectedColor;
                        }
                        break;

                    case "Block Color":
                        colorDiag.StartingColor = ColorSetting.Instance.BlockColor;
                        if (colorDiag.ShowDialog() == true)
                        {
                            ColorSetting.Instance.BlockColor = colorDiag.SelectedColor;
                        }
                        break;

                    default:
                        break;
                    }

                    ColorSettingsVM.Refresh();

                    colorSettingControl.DataContext = null;
                    colorSettingControl.DataContext = ColorSettingsVM;

                    Drawing.Figures.UpdateVisual();
                }
            }
        }