private void btnRebarBGColorChoose_Click(object sender, RoutedEventArgs e)
 {
     ColorDialogEx cd = new ColorDialogEx { Color = WorkingConfig.skin.RebarColor };
     if(System.Windows.Forms.DialogResult.OK == cd.ShowDialog()) {
         ((Button)sender).Tag = cd.Color;
     }
 }
Ejemplo n.º 2
0
 private void btnAltRowColor_Click(object sender, RoutedEventArgs e)
 {
     // Works for both buttons.  Each button's Tag is bound to the corresponding property.
     var button = (Button)sender;
     ColorDialogEx cd = new ColorDialogEx { Color = (System.Drawing.Color)button.Tag };
     if(System.Windows.Forms.DialogResult.OK == cd.ShowDialog()) {
         button.Tag = cd.Color;
     }
 }
Ejemplo n.º 3
0
        private void btnRebarBGColorChoose_Click(object sender, RoutedEventArgs e)
        {
            ColorDialogEx cd = new ColorDialogEx {
                Color = WorkingConfig.skin.RebarColor
            };

            if (System.Windows.Forms.DialogResult.OK == cd.ShowDialog())
            {
                ((Button)sender).Tag = cd.Color;
            }
        }
Ejemplo n.º 4
0
        private void miColorMenuEntry_OnClick(object sender, RoutedEventArgs e)
        {
            var           mi   = (MenuItem)sender;
            var           rect = (Rectangle)mi.Tag;
            ColorDialogEx cd   = new ColorDialogEx {
                Color = (System.Drawing.Color)rect.Tag
            };

            if (System.Windows.Forms.DialogResult.OK == cd.ShowDialog())
            {
                rect.Tag = cd.Color;
            }
        }
Ejemplo n.º 5
0
        private void btnAltRowColor_Click(object sender, RoutedEventArgs e)
        {
            // Works for both buttons.  Each button's Tag is bound to the corresponding property.
            var           button = (Button)sender;
            ColorDialogEx cd     = new ColorDialogEx {
                Color = (System.Drawing.Color)button.Tag
            };

            if (System.Windows.Forms.DialogResult.OK == cd.ShowDialog())
            {
                button.Tag = cd.Color;
            }
        }
Ejemplo n.º 6
0
        private void ColorPanel_Click(object sender, EventArgs e)
        {
            var owner = sender as Panel;

            if (owner == null)
            {
                return;
            }
            string title = null;

            try
            {
                title = Controls.Find(owner.Name + "Label", true).First().Text;
            }
            catch (Exception ex)
            {
                Log.Write(ex);
            }
            using (var dialog = new ColorDialogEx(this, title)
            {
                AllowFullOpen = true,
                AnyColor = true,
                SolidColorOnly = true,
                Color = owner.BackColor,
                FullOpen = true
            })
            {
                if (_customColors?.Length > 0)
                {
                    dialog.CustomColors = _customColors;
                }
                if (dialog.ShowDialog() != DialogResult.Cancel)
                {
                    if (dialog.Color != owner.BackColor)
                    {
                        owner.BackColor = Color.FromArgb(dialog.Color.R, dialog.Color.G, dialog.Color.B);
                    }
                    if (dialog.CustomColors != _customColors)
                    {
                        _customColors = dialog.CustomColors;
                    }
                }
            }
            if (_result == DialogResult.No)
            {
                _result = DialogResult.Yes;
            }
            StylePreviewUpdate();
        }
Ejemplo n.º 7
0
        private void ColorPanel_Click(object sender, EventArgs e)
        {
            if (!(sender is Panel owner))
            {
                return;
            }
            var title = default(string);

            try
            {
                title = Controls.Find(owner.Name + "Label", true).First().Text;
            }
            catch (Exception ex) when(ex.IsCaught())
            {
                Log.Write(ex);
            }
            using (var dialog = new ColorDialogEx(this, title)
            {
                AllowFullOpen = true,
                AnyColor = true,
                SolidColorOnly = true,
                Color = owner.BackColor,
                FullOpen = true
            })
            {
                if (Settings.Window.CustomColors.Any())
                {
                    dialog.CustomColors = Settings.Window.CustomColors;
                }
                if (dialog.ShowDialog() != DialogResult.Cancel)
                {
                    if (dialog.Color != owner.BackColor)
                    {
                        owner.BackColor = Color.FromArgb(dialog.Color.R, dialog.Color.G, dialog.Color.B);
                    }
                    var colors = dialog.CustomColors ?? Array.Empty <int>();
                    if (colors.SequenceEqual(Settings.Window.CustomColors) == false)
                    {
                        Settings.Window.CustomColors = dialog.CustomColors;
                    }
                }
            }
            if (Result != DialogResult.Yes)
            {
                Result = DialogResult.Yes;
            }
            StylePreviewUpdate();
        }
Ejemplo n.º 8
0
        private Color SelectColor(string title, Rectangle bounds, Color color)
        {
            var location = PointToScreen(toolStrip.Location);

            using (var dialog = new ColorDialogEx(title,
                                                  location.X + bounds.Location.X,
                                                  location.Y + bounds.Height + 4))
            {
                dialog.Color = color;

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    return(dialog.Color);
                }
            }

            return(Color.Empty);
        }
Ejemplo n.º 9
0
        private void ChooseCustomColor(object sender, EventArgs e)
        {
            if (initialized && customButton.Checked)
            {
                var location = PointToScreen(customButton.Location);

                using (var dialog = new ColorDialogEx(Resx.PageColorDialog_Text,
                                                      location.X + customButton.Bounds.Location.X + (customButton.Width / 2),
                                                      location.Y - 200))
                {
                    dialog.Color = pageColor;

                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        SetCustomOption(dialog.Color);
                    }
                }
            }
        }
Ejemplo n.º 10
0
 public virtual bool InsertAction(TextArea textArea, char ch)
 {
     if (!value.StartsWith("<"))
     {
         textArea.InsertString(value);
     }
     else
     {
         if (value == "<color>")
         {
             using (ColorDialogEx cd = new ColorDialogEx())
             {
                 if (cd.ShowDialog() == DialogResult.OK)
                 {
                     textArea.InsertString(HTMLColorConverter.convertColorToHtmlHexColor(cd.Color));
                 }
             }
         }
     }
     //LanguageBinding.QuickTemplate.InsertQuickTemplate("=", textArea.Caret.Offset, QuickletEngine.HtmlTemplateList, false);
     return(true);
 }
Ejemplo n.º 11
0
 private void btnAlternateColor_Click(object sender, EventArgs e) {
     if(sender == btnAlternate_Default) {
         QTUtility.ShellViewRowCOLORREF_Background = 0xfaf5f1;
         Color windowText = SystemColors.WindowText;
         QTUtility.ShellViewRowCOLORREF_Text = QTUtility2.MakeCOLORREF(windowText);
         btnAlternateColor.BackColor = QTUtility2.MakeColor(QTUtility.ShellViewRowCOLORREF_Background);
         btnAlternateColor_Text.ForeColor = windowText;
     }
     else {
         bool flag = sender == btnAlternateColor;
         using(ColorDialogEx ex = new ColorDialogEx()) {
             ex.Color = flag ? btnAlternateColor.BackColor : btnAlternateColor_Text.ForeColor;
             if(DialogResult.OK == ex.ShowDialog()) {
                 if(flag) {
                     btnAlternateColor.BackColor = ex.Color;
                 }
                 else {
                     btnAlternateColor_Text.ForeColor = ex.Color;
                 }
             }
         }
     }
 }
Ejemplo n.º 12
0
 private void buttonToolBarBGClr_Click(object sender, EventArgs e) {
     using(ColorDialogEx ex = new ColorDialogEx()) {
         ex.Color = btnToolBarBGClr.BackColor;
         if(DialogResult.OK == ex.ShowDialog()) {
             btnToolBarBGClr.BackColor = ex.Color;
         }
     }
 }
Ejemplo n.º 13
0
 private void buttonInactClr_Click(object sender, EventArgs e) {
     using(ColorDialogEx ex = new ColorDialogEx()) {
         ex.Color = btnInactTxtClr.ForeColor;
         if(DialogResult.OK == ex.ShowDialog()) {
             btnInactTxtClr.ForeColor = ex.Color;
         }
     }
 }
Ejemplo n.º 14
0
 private void buttonHL_Click(object sender, EventArgs e) {
     using(ColorDialogEx ex = new ColorDialogEx()) {
         ex.Color = btnHiliteClsc.ForeColor;
         if(DialogResult.OK == ex.ShowDialog()) {
             btnHiliteClsc.ForeColor = ex.Color;
         }
     }
 }
 private void miColorMenuEntry_OnClick(object sender, RoutedEventArgs e)
 {
     var mi = (MenuItem)sender;
     var rect = (Rectangle)mi.Tag;
     ColorDialogEx cd = new ColorDialogEx { Color = (System.Drawing.Color)rect.Tag };
     if(System.Windows.Forms.DialogResult.OK == cd.ShowDialog()) {
         rect.Tag = cd.Color;
     }
 }
Ejemplo n.º 16
0
 private void ColorPanel_Click(object sender, EventArgs e)
 {
     var owner = sender as Panel;
     if (owner == null)
         return;
     string title = null;
     try
     {
         title = Controls.Find(owner.Name + "Label", true).First().Text;
     }
     catch (Exception ex)
     {
         Log.Write(ex);
     }
     using (var dialog = new ColorDialogEx(this, title)
     {
         AllowFullOpen = true,
         AnyColor = true,
         SolidColorOnly = true,
         Color = owner.BackColor,
         FullOpen = true
     })
     {
         if (_customColors?.Length > 0)
             dialog.CustomColors = _customColors?.ToArray();
         if (dialog.ShowDialog() != DialogResult.Cancel)
         {
             if (dialog.Color != owner.BackColor)
                 owner.BackColor = Color.FromArgb(dialog.Color.R, dialog.Color.G, dialog.Color.B);
             if (_customColors?.ToArray() != dialog.CustomColors)
                 _customColors = dialog.CustomColors;
         }
     }
     if (!_result)
         _result = true;
     StylePreviewUpdate();
 }
Ejemplo n.º 17
0
 private void btnShadowClrs_Click(object sender, EventArgs e) {
     using(ColorDialogEx ex = new ColorDialogEx()) {
         ex.Color = ((Button)sender).ForeColor;
         if(DialogResult.OK == ex.ShowDialog()) {
             ((Button)sender).ForeColor = ex.Color;
         }
     }
 }
Ejemplo n.º 18
0
        // 设置图元属性
        private void SetElementProperty(TreeListNode node, string operate)
        {
            try
            {
                if (node == null || node.Tag == null)
                {
                    return;
                }

                string layerName   = "";
                string elementName = "";

                bool isSatellite = false;    // 是否是卫星

                string tag = node.Tag.ToString();
                if (!tag.Contains("-"))
                {
                    isSatellite = true;
                    string[] tagArr = tag.Split(new char[] { ':' });
                    layerName   = tagArr[0];
                    elementName = tagArr[1];
                }
                else
                {
                    isSatellite = false;
                    layerName   = "波束图层";
                    elementName = tag;
                }

                switch (operate)
                {
                case "flash":
                    if (!isSatellite)
                    {
                        SetGMapElementFlash(layerName, elementName);
                        SetGlobeElementFlash(layerName, elementName);
                        SetGlobeElementFlash("覆盖图层", elementName + "cover");
                        SetGlobeElementFlash("覆盖图层", elementName + "cover_line");
                    }
                    else
                    {
                        SetGlobeElementFlash(layerName, elementName);
                    }

                    break;

                case "color":
                    using (ColorDialogEx dlg = new ColorDialogEx())
                    {
                        if (dlg.ShowDialog() == DialogResult.OK)
                        {
                            Color color = dlg.GetColor();

                            if (!isSatellite)
                            {
                                SetGMapElementColor(layerName, elementName, color);
                                SetGlobeElementColor(layerName, elementName, color, isSatellite);
                                SetGlobeElementColor("覆盖图层", elementName + "cover", color, isSatellite);
                                SetGlobeElementColor("覆盖图层", elementName + "cover_line", color, isSatellite);
                            }
                            else
                            {
                                SetGlobeElementColor(layerName, elementName, color, isSatellite);
                            }
                        }
                    }

                    break;
                }
            }
            catch (Exception ex)
            {
                Log4Allen.WriteLog(typeof(LayersControl), ex.Message);
            }
        }