FontDialog ColorDialog 字体,颜色对话框的应用

FontDialog ColorDialog 字体,颜色对话框的应用
字体对话框,包括字体和字体颜色的设置
            FontDialog fd = new FontDialog();
            fd.ShowColor = true;
            fd.Font = txtCmdInput.Font;
            fd.Color = txtCmdInput.ForeColor;
            if(fd.ShowDialog()!= DialogResult.Cancel)
            {
                txtCmdInput.Font = fd.Font;
                txtCmdInput.ForeColor = fd.Color;
            }

颜色对话框,设置控件背景色
            ColorDialog cd = new ColorDialog();
            cd.Color = txtCmdInput.BackColor;
            if(cd.ShowDialog()!= DialogResult.Cancel)
            {
                txtCmdInput.BackColor = cd.Color;
            }

你可能感兴趣的:(FontDialog ColorDialog 字体,颜色对话框的应用)