本文整理汇总了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;
}
}
}
示例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;
}
示例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;
}
示例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();
}
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
}
示例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
));
}
示例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;
}
示例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();
}
}
}
示例12: OpenFormLineColor
public void OpenFormLineColor()
{
ColorDialog CD = new ColorDialog();
CD.ShowDialog();
Color newC = CD.Color;
SecondPicBrush = newC;
}
示例13: PickColor
private void PickColor()
{
ColorDialog cd = new ColorDialog {Color = Color};
cd.ShowDialog();
Color = cd.Color;
RaiseColorChangedEvent();
}
示例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);
}
}
}
}
示例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();
}