Beispiel #1
0
        /// <summary>
        /// Function to retrieve a color for the hatch pattern.
        /// </summary>
        /// <returns>The selected color or NULL (Nothing in VB.Net) if canceled.</returns>
        private GorgonColor?GetColor(GorgonColor oldColor)
        {
            ColorPickerDialog colorDialog = null;

            try
            {
                colorDialog = new ColorPickerDialog
                {
                    SelectedColor = oldColor,
                    OldColor      = oldColor
                };

                if (colorDialog.ShowDialog(ParentForm) == DialogResult.OK)
                {
                    return(colorDialog.SelectedColor);
                }
            }
            catch (Exception ex)
            {
                GorgonDialogs.ErrorBox(ParentForm, ex);
            }
            finally
            {
                if (colorDialog != null)
                {
                    colorDialog.Dispose();
                }
            }

            return(null);
        }
Beispiel #2
0
        /// <summary>
        /// Handles the Click event of the buttonExpando control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void buttonExpando_Click(object sender, EventArgs e)
        {
            ColorPickerDialog picker = null;

            try
            {
                picker = new ColorPickerDialog
                {
                    OldColor = CurrentColor
                };
                if (picker.ShowDialog() == DialogResult.OK)
                {
                    CurrentColor = picker.SelectedColor;
                }

                EditorService.CloseDropDown();
            }
            catch (Exception ex)
            {
                GorgonDialogs.ErrorBox(null, ex);
            }
            finally
            {
                if (picker != null)
                {
                    picker.Dispose();
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Function to get the preview text color.
        /// </summary>
        /// <param name="color">Color to update.</param>
        private void GetColor(ref Color color)
        {
            ColorPickerDialog colorDialog = null;

            try
            {
                colorDialog = new ColorPickerDialog
                {
                    OldColor = color
                };

                if (colorDialog.ShowDialog(ParentForm) != DialogResult.OK)
                {
                    return;
                }

                color = colorDialog.SelectedColor;
                panelTextColor.Refresh();
                panelBackColor.Refresh();
            }
            catch (Exception ex)
            {
                GorgonDialogs.ErrorBox(ParentForm, ex);
            }
            finally
            {
                if (colorDialog != null)
                {
                    colorDialog.Dispose();
                }
            }
        }
Beispiel #4
0
        private void Button4_Click(object sender, EventArgs e)
        {
            ColorPickerDialog MyDialog = new ColorPickerDialog();

            if (MyDialog.ShowDialog() == DialogResult.OK)
            {
                headerColor = MyDialog.Color;
                drawChallengeTemplate(headerColor, File.Exists(Properties.Settings.Default.challengesBannerFileName));
            }
            MyDialog.Dispose();
        }
Beispiel #5
0
        /// <summary>
        /// Function to allow for picking of the handle color.
        /// </summary>
        /// <param name="selectedHandle">Selected handle.</param>
        private void GetNodeColor(WeightHandle selectedHandle)
        {
            ColorPickerDialog color = null;

            try
            {
                color = new ColorPickerDialog
                {
                    SelectedColor = selectedHandle.Color,
                    OldColor      = selectedHandle.Color,
                    AlphaEnabled  = true
                };

                if (color.ShowDialog(ParentForm) != DialogResult.OK)
                {
                    return;
                }

                selectedHandle.Color = color.SelectedColor;
                OnChanged();
            }
            catch (Exception ex)
            {
                GorgonDialogs.ErrorBox(ParentForm, ex);
            }
            finally
            {
                DrawControls();
                DrawGradientDisplay();
                DrawPreview();
                DrawSelectedColor();

                if (color != null)
                {
                    color.Dispose();
                }
            }
        }