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


C# ColorDialog.ShowDialog方法代码示例

本文整理汇总了C#中System.Windows.Forms.ColorDialog.ShowDialog方法的典型用法代码示例。如果您正苦于以下问题:C# ColorDialog.ShowDialog方法的具体用法?C# ColorDialog.ShowDialog怎么用?C# ColorDialog.ShowDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.ColorDialog的用法示例。


在下文中一共展示了ColorDialog.ShowDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowColourPicker

        private void ShowColourPicker(int i, Button sender)
        {
            // Show the color dialog.
            ColorDialog colorDialog = new ColorDialog();
            DialogResult result = colorDialog.ShowDialog();
            // See if user pressed ok.
            if (result == DialogResult.OK)
            {
                // Set form background to the selected color.
                Colors[i] = colorDialog.Color;
                done[i] = true;
                sender.BackColor = Colors[i];

                bool allColorsPicked = true;
                foreach (bool fin in done)
                {
                    if (!fin)
                    {
                        allColorsPicked = false;
                        break;
                    }
                }
                if (allColorsPicked)
                {
                    OKbtn.Enabled = true;
                }
            }
        }
开发者ID:Kriogen777,项目名称:Otil,代码行数:28,代码来源:AddColorScheme.cs

示例2: LoadColorDialog

        private void LoadColorDialog(object sender, EventArgs eventArgs)
        {
            var btn = sender as Button;

            if (btn == null) return;

            var colorDiag = new ColorDialog
            {
                AnyColor = true,
                SolidColorOnly = true
            };

            if (colorDiag.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            if (btn == GoBtn) RadarSettings.Colors.GameObject = colorDiag.Color;
            if (btn == MeBtn) RadarSettings.Colors.PlayerMe = colorDiag.Color;
            if (btn == PetsBtn) RadarSettings.Colors.Pet = colorDiag.Color;
            if (btn == PetsDeadBtn) RadarSettings.Colors.PetDead = colorDiag.Color;
            if (btn == PlayersDeadBtn) RadarSettings.Colors.PlayerDead = colorDiag.Color;
            if (btn == PlayersOppBtn) RadarSettings.Colors.PlayerOpposing = colorDiag.Color;
            if (btn == PlayersSameBtn) RadarSettings.Colors.PlayerSame = colorDiag.Color;
            if (btn == RadarBtn) RadarSettings.Colors.Radar = colorDiag.Color;
            if (btn == TargetBtn) RadarSettings.Colors.Target = colorDiag.Color;
            if (btn == TargetDeadBtn) RadarSettings.Colors.TargetDead = colorDiag.Color;
            if (btn == UnitsBtn) RadarSettings.Colors.Unit = colorDiag.Color;
            if (btn == UnitsDeadBtn) RadarSettings.Colors.UnitDead = colorDiag.Color;

            btn.BackColor = colorDiag.Color;
        }
开发者ID:LaoArchAngel,项目名称:WRadar,代码行数:32,代码来源:Colors.cs

示例3: pnlBgColor_Click

        private void pnlBgColor_Click(object sender, EventArgs e)
        {
            ColorDialog clrDlg = new ColorDialog();

            DialogResult res = clrDlg.ShowDialog();

            if (res != DialogResult.OK)
                return;

            Application.DoEvents();

            this.pnlBgColor.Image = null;
            this.pnlBgColor.BackColor = clrDlg.Color;

            Extra.Enable = true;
            Extra.BackgroundColor = clrDlg.Color;

            Bitmap b = frmMain.FilterEffects(false);

            if (this.pbxPreview.Image != null)
            {
                Image prev = this.pbxPreview.Image;
                this.pbxPreview.Image = null;
                prev.Dispose();
            }

            this.pbxPreview.Image = b;

        }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:29,代码来源:FormSaveFileDialog.cs

示例4: btnFillColor_Click

        private void btnFillColor_Click(object sender, EventArgs e)
        {
            ColorDialog colorDialog = new ColorDialog();
            DialogResult result = colorDialog.ShowDialog();
            if (result == DialogResult.OK)
            {
                btnFillColor.BackColor = colorDialog.Color;

                ISymbol pSymbol = m_styleGalleryItem.Item as ISymbol;
                if (pSymbol == null) return;

                if (pSymbol is IMarkerSymbol)
                {
                    IMarkerSymbol markerSymbol = pSymbol as IMarkerSymbol;
                    markerSymbol.Color = GetRGBColor(colorDialog.Color.R, colorDialog.Color.G, colorDialog.Color.B);
                }
                else if (pSymbol is ILineSymbol)
                {
                    ILineSymbol lineSymbol = pSymbol as ILineSymbol;
                    lineSymbol.Color = GetRGBColor(colorDialog.Color.R, colorDialog.Color.G, colorDialog.Color.B);
                }
                else if (pSymbol is IFillSymbol)
                {
                    IFillSymbol fillSymbol = pSymbol as IFillSymbol;
                    fillSymbol.Color = GetRGBColor(colorDialog.Color.R, colorDialog.Color.G, colorDialog.Color.B);
                }
                else
                    return;

                PreviewImage();
            }
        }
开发者ID:lovelll,项目名称:YNDQHP,代码行数:32,代码来源:SymbolForm.cs

示例5: HandleColorButtonClick

 void HandleColorButtonClick(object sender, EventArgs e)
 {
     ColorDialog colorDialog = new ColorDialog();
     colorDialog.Color =m_Button.BackColor;
     DialogResult dr = colorDialog.ShowDialog();
     m_Button.BackColor = colorDialog.Color;
 }
开发者ID:ShadyEM,项目名称:Twister3D,代码行数:7,代码来源:DataControl_Color3.cs

示例6: panelFor3DBackColor_MouseDoubleClick

 private void panelFor3DBackColor_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     ColorDialog CD = new ColorDialog();
     CD.Color = panelFor3DBackColor.BackColor;
     if (CD.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;
     panelFor3DBackColor.BackColor = CD.Color;
 }
开发者ID:cyrenaique,项目名称:HCSA,代码行数:7,代码来源:FormForAllOptions.cs

示例7: btSelectColor_Click

 private void btSelectColor_Click(object sender, EventArgs e)
 {
     ColorDialog frmSelectColor = new ColorDialog();
     frmSelectColor.Color = btSelectColor.BackColor;
     if (frmSelectColor.ShowDialog() == DialogResult.OK)
         btSelectColor.BackColor = frmSelectColor.Color;
 }
开发者ID:saniainf,项目名称:BcardBase,代码行数:7,代码来源:frmNewManager.cs

示例8: chooseBackgroundColorToolStripMenuItem_Click

        private void chooseBackgroundColorToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //create undo/redo commands for this
            List<IUndoRedoCmd> undoCmd = new List<IUndoRedoCmd>();

            //bring up color dialog
            ColorDialog cd = new ColorDialog();

            //color has been chosen
            if(cd.ShowDialog() == DialogResult.OK)
            {
                //chosen color
                int color = cd.Color.ToArgb();

                foreach (DataGridViewCell cell in MySpreadsheet.SelectedCells)
                {
                    //get corresponding spreadsheet cell in data
                    Cell spreadsheetCell = the_workbook.activeSheet.GetCell(cell.RowIndex, cell.ColumnIndex);

                    //add color change to undo list
                    undoCmd.Add(new BGColorCmd(spreadsheetCell.Name, spreadsheetCell.BGColor));

                    //change selected cell bgcolor
                    spreadsheetCell.BGColor = color;
                }

                //add to undo redo system
                the_workbook.UndoRedoSys.addUndo(new UndoRedoCollection(undoCmd, "background color change"));
                UpdateUndoRedoDescriptions();
            }
        }
开发者ID:cjskillingstad,项目名称:322SpreadsheetApplication,代码行数:31,代码来源:Form1.cs

示例9: BTNEFontColor_Click

        private void BTNEFontColor_Click(object sender, EventArgs e)
        {
            if (SelectingFontContext) return;
            if (CBEPickFontContext.SelectedIndex == -1) return;

            ColorDialog dialog = new ColorDialog();
            dialog.Color = currentFontColor;
            if (dialog.ShowDialog(this) == DialogResult.Cancel)
                return;
            currentFontColor = dialog.Color;

            Options.Editor.SetMod((Options.FontStyles)CBEPickFontContext.SelectedIndex, new FontModification(
                                                                                             (CBEBoldFond.Checked
                                                                                                  ? FontStyle.Bold
                                                                                                  : FontStyle.Regular) |
                                                                                             (CBEItalicsFont.Checked
                                                                                                  ? FontStyle.Italic
                                                                                                  : FontStyle.Regular) |
                                                                                             (CBEFontUnderline.Checked
                                                                                                  ? FontStyle.Underline
                                                                                                  : FontStyle.Regular) |
                                                                                             (CBEFontStrikeout.Checked
                                                                                                  ? FontStyle.Strikeout
                                                                                                  : FontStyle.Regular),
                                                                                             currentFontColor
                                                                                             ));
        }
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:27,代码来源:OptionsForm.cs

示例10: EditValue

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
                service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (service != null)
            {
                // This is the code you want to run when the [...] is clicked and after it has been verified.

                // Get our currently selected color.
                MyColor color = (MyColor)value;

                // Create a new instance of the ColorDialog.
                ColorDialog selectionControl = new ColorDialog();

                // Set the selected color in the dialog.
                selectionControl.Color = Color.FromArgb(color.GetARGB());

                // Show the dialog.
                selectionControl.ShowDialog();

                // Return the newly selected color.
                value = new MyColor(selectionControl.Color.ToArgb());
                //value = ColorTranslator.ToHtml(selectionControl.Color);
            }

            return value;
        }
开发者ID:zulis,项目名称:Sandbox,代码行数:28,代码来源:MyColorEditor.cs

示例11: DoColorCodeWizard

        private void DoColorCodeWizard(object aSender, EventArgs e) {
            if (ValidationHelpers.ValidateCurrentModuleIsCSFile())
            {
                ColorDialog _ColorDialog = new ColorDialog();

                if (_ColorDialog.ShowDialog() == DialogResult.OK)
                {
                    string _Color;

                    if (_ColorDialog.Color.IsKnownColor)
                    {
                        _Color = "Color." + _ColorDialog.Color.ToKnownColor();
                    }
                    else
                    {
                        _Color = "Color.FromArgb(((byte)(" + _ColorDialog.Color.R +
                                  ")), ((byte)(" + _ColorDialog.Color.G +
                                  ")), ((byte)(" + _ColorDialog.Color.B +
                                  ")));";
                    }

                    IOTASourceEditor _SourceEditor = OtaUtils.GetCurrentSourceEditor();
                    OtaUtils.ReplaceSelectedText(_SourceEditor, _Color);

                    IOTAEditView _EditView = OtaUtils.GetEditView(_SourceEditor);
                    _EditView.MoveViewToCursor();
                    _EditView.Paint();
                }
            }
        }
开发者ID:divyang4481,项目名称:lextudio,代码行数:30,代码来源:ColorPalletteFeature.cs

示例12: OpenFormLineColor

 public void OpenFormLineColor()
 {
     ColorDialog CD = new ColorDialog();
     CD.ShowDialog();
     Color newC = CD.Color;
     SecondPicBrush = newC;
 }
开发者ID:sLevet,项目名称:projetImage,代码行数:7,代码来源:FunctionsImage.cs

示例13: PickColor

		private void PickColor()
		{
			ColorDialog cd = new ColorDialog {Color = Color};
			cd.ShowDialog();
			Color = cd.Color;
			RaiseColorChangedEvent();
		}
开发者ID:CaptainTF,项目名称:bukkitgui2,代码行数:7,代码来源:ColorPicker.cs

示例14: OnMouseUp

 protected override void OnMouseUp(MouseEventArgs mevent)
 {
     IsDragMode = false;
     base.OnMouseUp(mevent);
     if (mevent.Button == MouseButtons.Right)
     {
         using (ColorDialog cd = new ColorDialog())
         {
             cd.FullOpen = true;
             if (cd.ShowDialog() == DialogResult.OK)
             {
                 this.ForeColor = cd.Color;
             }
         }
         using (FontDialog fd = new FontDialog())
         {
             try
             {
                 fd.AllowScriptChange = false;
                 fd.AllowSimulations = false;
                 if (fd.ShowDialog() == DialogResult.OK)
                 {
                     this.Font = fd.Font;
                 }
             }
             catch (Exception ex)
             {
                 //Not a truetype font
                 MessageBox.Show(this, ex.Message + Environment.NewLine + "Шрифт не изменен.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
     }
 }
开发者ID:Ossir,项目名称:Ad-Constructor,代码行数:33,代码来源:TextBox.cs

示例15: panelColor_MouseClick

 private void panelColor_MouseClick(object sender, MouseEventArgs e)
 {
     ColorDialog ColorPicker = new ColorDialog();
     if(ColorPicker.ShowDialog() != DialogResult.OK) return;
     panelColor.BackColor = ColorPicker.Color;
     panelColor.Refresh();
 }
开发者ID:cyrenaique,项目名称:HCSA,代码行数:7,代码来源:PanelForParamGeneralForCellType.cs


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