当前位置: 首页>>代码示例>>C#>>正文


C# ColorPicker.ShowDialog方法代码示例

本文整理汇总了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 + "";
 }
开发者ID:mbl111,项目名称:Ava,代码行数:7,代码来源:MainForm.cs

示例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();
				}
			}
		}
开发者ID:stewmc,项目名称:vixen,代码行数:9,代码来源:ColorPanel.cs

示例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();
				}
			}
		}
开发者ID:stewmc,项目名称:vixen,代码行数:10,代码来源:ColorBreakdownItemControl.cs

示例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();
         }
     }
 }
开发者ID:kjburns31,项目名称:vixen-modules,代码行数:11,代码来源:ColorTypeEditorControl.cs

示例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;
		}
开发者ID:stewmc,项目名称:vixen,代码行数:46,代码来源:ColorTypeEditor.cs

示例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);
         }
     }
 }
开发者ID:komby,项目名称:vixen,代码行数:21,代码来源:ColorCollectionLibrary_Form.cs

示例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);
         }
     }
 }
开发者ID:jaredb7,项目名称:vixen,代码行数:21,代码来源:ColorCollectionLibrary_Form.cs

示例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;
        }
开发者ID:jmcadams,项目名称:vplus,代码行数:24,代码来源:ChannelsTab.cs

示例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 );
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:7,代码来源:MainForm.cs

示例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();
			}
		}
开发者ID:stewmc,项目名称:vixen,代码行数:15,代码来源:Form_ToolPalette.cs

示例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();
			}
		}
开发者ID:stewmc,项目名称:vixen,代码行数:23,代码来源:Form_ToolPalette.cs

示例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();
             }
         }
     }
 }
开发者ID:jaredb7,项目名称:vixen,代码行数:37,代码来源:LipSyncMapColorCtrl.cs

示例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 );
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:7,代码来源:ConfigUI.cs

示例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 );
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:7,代码来源:ConfigUI.cs

示例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 );
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:7,代码来源:MainForm.cs


注:本文中的ColorPicker.ShowDialog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。