ColorDialog.MouseDown : ColorDialog « System.Windows.Forms « C# / C Sharp by API






ColorDialog.MouseDown

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

public class MainForm : Form {
    private ColorDialog colorDlg;
    private Color currColor = Color.DimGray;

    public MainForm() {
        CenterToScreen();
        colorDlg = new ColorDialog();
        this.MouseDown += new MouseEventHandler(MainForm_MouseDown);
    }

    void MainForm_MouseDown(object sender, MouseEventArgs e) {
        if (colorDlg.ShowDialog() != DialogResult.Cancel) {
            currColor = colorDlg.Color;
            this.BackColor = currColor;
            string strARGB = colorDlg.Color.ToString();
            MessageBox.Show(strARGB, "Color is:");
        }
    }
}

   
  








Related examples in the same category

1.ColorDialog.AllowFullOpen
2.ColorDialog.AnyColor
3.ColorDialog.Color
4.ColorDialog.CustomColor
5.ColorDialog.FullOpen
6.ColorDialog.ShowDialog()
7.ColorDialog.ShowHelp