本文整理汇总了C#中ColorPicker.ShowDialog方法的典型用法代码示例。如果您正苦于以下问题:C# ColorPicker.ShowDialog方法的具体用法?C# ColorPicker.ShowDialog怎么用?C# ColorPicker.ShowDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ColorPicker
的用法示例。
在下文中一共展示了ColorPicker.ShowDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainForm
public MainForm()
{
InitializeComponent();
ColorPicker picker = new ColorPicker("Auto");
picker.ShowDialog();
button1.Text = picker.ColorIndex + "";
}
示例2: ColorPanel_Click
private void ColorPanel_Click(object sender, EventArgs e)
{
using (ColorPicker picker = new ColorPicker()) {
picker.Color = XYZ.FromRGB(Color);
if (picker.ShowDialog() == DialogResult.OK) {
Color = picker.Color.ToRGB();
}
}
}
示例3: panelColor_Click
private void panelColor_Click(object sender, EventArgs e)
{
using (ColorPicker cp = new ColorPicker()) {
cp.Color = XYZ.FromRGB(panelColor.BackColor);
DialogResult result = cp.ShowDialog();
if (result == DialogResult.OK) {
panelColor.BackColor = cp.Color.ToRGB().ToArgb();
}
}
}
示例4: panelColor_Click
private void panelColor_Click(object sender, EventArgs e)
{
using (ColorPicker cp = new ColorPicker()) {
cp.LockValue_V = true;
cp.Color = XYZ.FromRGB(ColorValue);
DialogResult result = cp.ShowDialog();
if (result == DialogResult.OK) {
ColorValue = cp.Color.ToRGB().ToArgb();
}
}
}
示例5: ShowDialog
public override Object ShowDialog(PropertyItem propertyItem, Object propertyValue, IInputElement commandSource)
{
HashSet<Color> discreteColors = GetDiscreteColors(propertyItem.Component);
Color colorValue;
if (propertyValue != null)
{
colorValue = (Color)propertyValue;
}
else
{
colorValue = discreteColors.Any() ? discreteColors.First() : Color.White;
}
DialogResult result;
if (discreteColors.Any())
{
using (DiscreteColorPicker dcp = new DiscreteColorPicker())
{
dcp.ValidColors = discreteColors;
dcp.SingleColorOnly = true;
dcp.SelectedColors = new List<Color> {colorValue};
dcp.Text = propertyItem.DisplayName;
result = dcp.ShowDialog();
if (result == DialogResult.OK)
{
propertyValue = !dcp.SelectedColors.Any() ? discreteColors.First() : dcp.SelectedColors.First();
}
}
}
else
{
using (ColorPicker cp = new ColorPicker())
{
cp.LockValue_V = true;
cp.Color = XYZ.FromRGB(colorValue);
cp.Text = propertyItem.DisplayName;
result = cp.ShowDialog();
if (result == DialogResult.OK)
{
propertyValue = cp.Color.ToRGB().ToArgb();
}
}
}
return propertyValue;
}
示例6: btnAddColor_Click
private void btnAddColor_Click(object sender, EventArgs e)
{
if (CurrentCollection == null)
return;
using (ColorPicker cp = new ColorPicker())
{
cp.LockValue_V = true;
cp.Color = XYZ.FromRGB(ColorValue);
cp.StartPosition = FormStartPosition.Manual;
cp.Top = this.Top;
cp.Left = this.Left + this.Width;
DialogResult result = cp.ShowDialog();
if (result == DialogResult.OK)
{
ColorValue = cp.Color.ToRGB().ToArgb();
CurrentCollection.Color.Add(ColorValue);
isDirty = true;
PopulateCollectionColors(CurrentCollection);
}
}
}
示例7: AddColorToCollection
private void AddColorToCollection()
{
if (_currentCollection == null)
return;
using (ColorPicker cp = new ColorPicker())
{
cp.LockValue_V = false;
cp.Color = XYZ.FromRGB(_colorValue);
cp.StartPosition = FormStartPosition.Manual;
cp.Top = Top;
cp.Left = Left + Width;
DialogResult result = cp.ShowDialog();
if (result == DialogResult.OK)
{
_colorValue = cp.Color.ToRGB().ToArgb();
_currentCollection.Color.Add(_colorValue);
_isDirty = true;
PopulateCollectionColors(_currentCollection);
}
}
}
示例8: GetColor
private static bool GetColor(Control ctrl, Color initialColor, out Color resultColor, bool showNone = true)
{
var result = false;
resultColor = Color.Black;
const int offset = 6;
using (var dialog = new ColorPicker(initialColor, showNone)) {
dialog.Location = dialog.GetBestLocation(ctrl.PointToScreen(new Point(0, 0)), offset);
dialog.ShowDialog();
switch (dialog.DialogResult) {
case DialogResult.OK:
resultColor = dialog.GetColor();
result = true;
break;
case DialogResult.No:
resultColor = Color.Transparent;
result = true;
break;
}
}
return result;
}
示例9: bColorSys_Click
private void bColorSys_Click( object sender, EventArgs e ) {
ColorPicker picker = new ColorPicker( "System message color", colorSys );
picker.ShowDialog();
colorSys = picker.ColorIndex;
ApplyColor( bColorSys, colorSys );
Color.Sys = Parse( colorSys );
}
示例10: toolStripButtonNewColor_Click
private void toolStripButtonNewColor_Click(object sender, EventArgs e)
{
using (ColorPicker cp = new ColorPicker())
{
cp.LockValue_V = true;
cp.Color = XYZ.FromRGB(Color.White);
DialogResult result = cp.ShowDialog();
if (result != DialogResult.OK) return;
Color colorValue = cp.Color.ToRGB().ToArgb();
_colors.Add(colorValue);
PopulateColors();
Save_ColorPaletteFile();
}
}
示例11: toolStripButtonEditColor_Click
private void toolStripButtonEditColor_Click(object sender, EventArgs e)
{
if (listViewColors.SelectedItems.Count != 1)
return;
using (ColorPicker cp = new ColorPicker())
{
cp.LockValue_V = true;
cp.Color = XYZ.FromRGB((Color)listViewColors.SelectedItems[0].Tag);
DialogResult result = cp.ShowDialog();
if (result != DialogResult.OK) return;
Color colorValue = cp.Color.ToRGB().ToArgb();
listViewColors.BeginUpdate();
listViewColors.SelectedItems[0].ToolTipText = string.Format("R: {0} G: {1} B: {2}", colorValue.R, colorValue.G, colorValue.B);
listViewColors.SelectedItems[0].ImageKey = colorValue.ToString();
listViewColors.SelectedItems[0].Tag = colorValue;
listViewColors.EndUpdate();
Update_ColorOrder();
PopulateColors();
}
}
示例12: panelColor_Click
private void panelColor_Click(object sender, EventArgs e)
{
if (_discreteColors)
{
using (DiscreteColorPicker dcp = new DiscreteColorPicker())
{
dcp.ValidColors = _validDiscreteColors;
dcp.SingleColorOnly = true;
dcp.SelectedColors = new List<Color> { Color };
DialogResult result = dcp.ShowDialog();
if (result == DialogResult.OK)
{
if (dcp.SelectedColors.Count() == 0)
{
Color = Color.White;
}
else
{
RGBColor = dcp.SelectedColors.First();
}
}
}
}
else
{
using (ColorPicker cp = new ColorPicker())
{
cp.LockValue_V = false;
cp.Color = XYZ.FromRGB(Color);
DialogResult result = cp.ShowDialog();
if (result == DialogResult.OK)
{
RGBColor = cp.Color.ToRGB();
}
}
}
}
示例13: bColorMe_Click
private void bColorMe_Click( object sender, EventArgs e ) {
ColorPicker picker = new ColorPicker( "/me command color", colorMe );
picker.ShowDialog();
colorMe = picker.color;
ApplyColor( bColorMe, colorMe );
fCraft.Color.Me = fCraft.Color.Parse( colorMe );
}
示例14: bColorSay_Click
private void bColorSay_Click( object sender, EventArgs e ) {
ColorPicker picker = new ColorPicker( "/say message color", colorSay );
picker.ShowDialog();
colorSay = picker.color;
ApplyColor( bColorSay, colorSay );
fCraft.Color.Say = fCraft.Color.Parse( colorSay );
}
示例15: bColorIRC_Click
private void bColorIRC_Click( object sender, EventArgs e ) {
ColorPicker picker = new ColorPicker( "IRC message color", colorIRC );
picker.ShowDialog();
colorIRC = picker.ColorIndex;
ApplyColor( bColorIRC, colorIRC );
Color.IRC = Parse( colorIRC );
}