Example #1
0
        private static void SaveToastIcon(Color color)
        {
            Bitmap Bmp = new Bitmap(100, 100);

            using (Graphics gfx = Graphics.FromImage(Bmp))
            {
                using (SolidBrush brush = new SolidBrush(color))
                {
                    gfx.FillRectangle(brush, 0, 0, 100, 100);
                    Bmp.Save(Path.GetTempPath() + "xEyedropperToast.ico");

                    ConvertColor.ConvertToIco((Image)Bmp, Path.GetTempPath() + "xEyedropperToast.ico", 100);
                    notifyIcon.BalloonTipText = Clipboard.GetText().ToString();
                    notifyIcon.Icon           = new Icon(Path.GetTempPath() + "xEyedropperToast.ico");
                    notifyIcon.ShowBalloonTip(0);
                    Thread.Sleep(200);
                    notifyIcon.Icon = new Icon(Resources.ICON, 100, 100);
                }
            }
        }
Example #2
0
        private static void MenuItemHTML_Click(object sender, EventArgs e)
        {
            try
            {
                string color = Clipboard.GetText();

                Clipboard.SetText(ConvertColor.HexConverter(ColorTranslator.FromHtml(color)));
            }
            catch (Exception)
            {
                // ignore
            }

            menuItemRGB.Checked        = false;
            menuItemHTML.Checked       = true;
            Settings.Default.ColorRGB  = false;
            Settings.Default.ColorHTML = true;
            Settings.Default.Save();

            Settings.Default.Reload();
        }
Example #3
0
        private void PreviewImage_MouseDown(object sender, MouseEventArgs e)
        {
            thread.Abort();

            if (e.Button == MouseButtons.Left)
            {
                Color color = GetColorFromPixel(Cursor.Position.X, Cursor.Position.Y);

                if (Properties.Settings.Default.ColorHTML)
                {
                    Clipboard.SetText(ConvertColor.HexConverter(color));
                }
                else if (Properties.Settings.Default.ColorRGB)
                {
                    Clipboard.SetText(ConvertColor.RGBConverter(color));
                }
            }
            else
            {
                Program.cancelled = true;
            }

            this.Close();
        }
Example #4
0
        private static void Editor()
        {
            try
            {
                string color = Clipboard.GetText();
                if (!string.IsNullOrEmpty(color))
                {
                    Color col = ColorTranslator.FromHtml(color);
                    Settings.Default.ColorDialogWithTitle_DefaultTitle = "Color in Clipboard: " + ConvertColor.RGBConverter(col);
                    Settings.Default.Save();
                    Settings.Default.Reload();
                }
                else
                {
                    Settings.Default.ColorDialogWithTitle_DefaultTitle = "Color Dialog";
                    Settings.Default.Save();
                    Settings.Default.Reload();
                }
            }
            catch
            {
                Settings.Default.ColorDialogWithTitle_DefaultTitle = "Color Dialog";
                Settings.Default.Save();
                Settings.Default.Reload();
            }

            using (colorDialog1 = new ColorDialogWithTitle())
            {
                colorDialog1.FullOpen = true;

                try
                {
                    string color = Clipboard.GetText();
                    colorDialog1.Color = ColorTranslator.FromHtml(color);
                }
                catch
                {
                }

                if (menuItemResetCustomColor.Checked)
                {
                    colorDialog1.CustomColors = new int[] { 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215 };

                    SaveCustomColors();
                }
                else
                {
                    colorDialog1.CustomColors = new int[] { Settings.Default.CustomColor1, Settings.Default.CustomColor2, Settings.Default.CustomColor3, Settings.Default.CustomColor4, Settings.Default.CustomColor5, Settings.Default.CustomColor6, Settings.Default.CustomColor7, Settings.Default.CustomColor8, Settings.Default.CustomColor9, Settings.Default.CustomColor10, Settings.Default.CustomColor11, Settings.Default.CustomColor12, Settings.Default.CustomColor13, Settings.Default.CustomColor14, Settings.Default.CustomColor15, Settings.Default.CustomColor16 };
                }

                if (colorDialog1.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        Color selectedColor = colorDialog1.Color;

                        if (Settings.Default.ColorHTML)
                        {
                            Clipboard.SetText(ConvertColor.HexConverter(selectedColor));
                        }
                        else if (Settings.Default.ColorRGB)
                        {
                            Clipboard.SetText(ConvertColor.RGBConverter(selectedColor));
                        }

                        if (Settings.Default.SaveCustomColors)
                        {
                            SaveCustomColors();
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }