Exemplo n.º 1
0
        void customColorsPage_Click(object sender, System.EventArgs e)
        {
            // Get current mouse position
            Point screenMousePos = Control.MousePosition;
            // Convert mouse position to client coordinates
            Point clientMousePos = customColorsPage.PointToClient(screenMousePos);

            if (rightButtonDown == true)
            {
                // Check if we need to show the custom color color picker dialog
                int index = -1;
                if (IsSpareColor(clientMousePos, ref index))
                {
                    CustomColorDlg dlg = new CustomColorDlg();
                    dlg.CurrentColor = customColors[index];
                    if (dlg.ShowDialog(this) == DialogResult.OK)
                    {
                        customColors[index] = dlg.CurrentColor;
                        ColorChangeArgs ca = new ColorChangeArgs(dlg.CurrentColor, "CustomTab");
                        OnColorChanged(ca);
                    }
                }
                rightButtonDown = false;
                return;
            }

            Graphics g            = customColorsPage.CreateGraphics();
            Color    clickedColor = ColorUtil.ColorFromPoint(g, clientMousePos.X, clientMousePos.Y);

            g.Dispose();

            Color color = FindCustomColor(clientMousePos);

            if (color != Color.Empty)
            {
                ColorChangeArgs ca = new ColorChangeArgs(color, "CustomTab");
                OnColorChanged(ca);
                // Hide the dropdown
                exitLoop = true;
                Visible  = false;
            }
        }
        void customColorsPage_Click(object sender, System.EventArgs e)
        {
            // Get current mouse position
              Point screenMousePos = Control.MousePosition;
              // Convert mouse position to client coordinates
              Point clientMousePos = customColorsPage.PointToClient(screenMousePos);
              if ( rightButtonDown == true )
              {
            // Check if we need to show the custom color color picker dialog
            int index = -1;
            if ( IsSpareColor(clientMousePos, ref index))
            {
              CustomColorDlg dlg = new CustomColorDlg();
              dlg.CurrentColor = customColors[index];
              if ( dlg.ShowDialog(this) == DialogResult.OK )
              {
            customColors[index] = dlg.CurrentColor;
            ColorChangeArgs ca = new ColorChangeArgs(dlg.CurrentColor, "CustomTab");
            OnColorChanged(ca);
              }
            }
            rightButtonDown = false;
            return;
              }

              Graphics g = customColorsPage.CreateGraphics();
              Color clickedColor = ColorUtil.ColorFromPoint(g, clientMousePos.X, clientMousePos.Y);
              g.Dispose();

              Color color = FindCustomColor(clientMousePos);
              if ( color != Color.Empty )
              {
            ColorChangeArgs ca = new ColorChangeArgs(color, "CustomTab");
            OnColorChanged(ca);
            // Hide the dropdown
            exitLoop = true;
            Visible = false;
              }
        }