本文整理汇总了C#中System.Windows.Forms.ColorDialog类的典型用法代码示例。如果您正苦于以下问题:C# ColorDialog类的具体用法?C# ColorDialog怎么用?C# ColorDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ColorDialog类属于System.Windows.Forms命名空间,在下文中一共展示了ColorDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: backgroundToolStripMenuItem_Click
private void backgroundToolStripMenuItem_Click(object sender, EventArgs e)
{
ColorDialog backgroundColor = new ColorDialog();
if (backgroundColor.ShowDialog() == DialogResult.OK){
notepad_interface.BackColor = backgroundColor.Color;
}
}
示例2: 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;
}
示例3: Form1
public Form1()
{
InitializeComponent();
cd = new ColorDialog();
ld = new SHMUP.Screens.Levels.LevelManager.LevelData();
sfd = new SaveFileDialog();
sfd.Filter = "SHMUP Level File (*.lvl)|*.lvl";
ofd = new OpenFileDialog();
ofd.Filter = "SHMUP Level File (*.lvl)|*.lvl";
//for (int i = 0; i < (int)SHMUP.Screens.Levels.LevelManager.bosses.ZZZEndOfList; i++)
//{
// comBossType.Items.Add((SHMUP.Screens.Levels.LevelManager.bosses)i);
//}
string appPath = Application.ExecutablePath.Remove(Application.ExecutablePath.LastIndexOf(Path.DirectorySeparatorChar));
String[] bosses = Directory.GetFiles(Path.Combine(Path.Combine(appPath, "Content"), "Bosses"), "*.bos");
for (int i = 0; i < bosses.Length; i++)
{
bosses[i] = bosses[i].Remove(0, Path.Combine(Path.Combine(appPath, "Content"), "Bosses").Length + 1);
bosses[i] = bosses[i].Remove(bosses[i].LastIndexOf(".bos"));
comBossType.Items.Add(bosses[i]);
}
for (int i = 0; i < (int)SHMUP.Screens.Levels.LevelManager.enemies.ZZZEndOfList; i++)
{
comEnemyType.Items.Add((SHMUP.Screens.Levels.LevelManager.enemies)i);
}
ClearAll();
}
示例4: TgcColorModifier
public TgcColorModifier(string varName, Color defaultValue)
: base(varName)
{
colorPanel = new FlowLayoutPanel();
colorPanel.Margin = new Padding(0);
colorPanel.AutoSize = true;
colorPanel.FlowDirection = FlowDirection.LeftToRight;
colorLabel = new Label();
colorLabel.Margin = new Padding(0);
colorLabel.Size = new Size(80, 40);
colorLabel.BackColor = defaultValue;
colorLabel.BorderStyle = BorderStyle.FixedSingle;
colorLabel.Click += new EventHandler(colorButton_click);
colorPanel.Controls.Add(colorLabel);
colorDialog = new ColorDialog();
colorDialog.Color = defaultValue;
colorDialog.AllowFullOpen = true;
colorDialog.AnyColor = true;
colorDialog.FullOpen = true;
contentPanel.Controls.Add(colorPanel);
}
示例5: Execute
public override void Execute(object @object)
{
if (!Enabled)
{
return;
}
if (EditorObserver.ActiveEditor == null)
{
return;
}
using (var cd = new ColorDialog())
{
if (cd.ShowDialog(EditorObserver.DialogOwner) == DialogResult.OK)
{
try
{
EditorObserver.ActiveEditor.SetBackColor(cd.Color);
}
catch (Exception exception)
{
ExceptionManager.Instance.LogException(exception);
UIHelper.ShowMessage(operationCantBePerformedMessage,
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
示例6: ApplyCustomColors
private void ApplyCustomColors(ColorDialog colorDialog)
{
if (customColors != null && customColors.Any())
{
colorDialog.CustomColors = customColors;
}
}
示例7: 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;
}
示例8: Form1
public Form1()
{
InitializeComponent();
Text = String.Format("{0} {1}", AboutBox1.AssemblyTitle, AboutBox1.AssemblyVersion);
this.pathOfVtk = Directory.GetCurrentDirectory();
GraphicsInitialization();
EffectsInitialization();
nodes = new Nodes();
dataToRender = new DataToRender(this);
Rotation = Matrix.RotationX(angleY) * Matrix.RotationY(angleX);
viewMatrix = Matrix.LookAtRH(new Vector3(0, 0, -3.5f), new Vector3(0, 0, 0), new Vector3(0, 1, 0));
aTimer = new System.Timers.Timer();
aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
aTimer.Interval = 800;
aTimer.Enabled = true;
colorDialog = new ColorDialog();
colorDialog.Color = System.Drawing.Color.Red;
StatusInfo = "No data loaded";
toolStripProgressBar1.Value = 0;
bielePozadieToolStripMenuItem.Checked = false;
panel1.Resize += (sender, args) => resized = true;
Configuration.EnableObjectTracking = false;
resized = true;
render = true;
}
示例9: OpenColorPicker
private void OpenColorPicker(object sender, EventArgs e)
{
var spl = _textBox.Text.Split(' ');
float r = 0, g = 0, b = 0;
if (spl.Length >= 3)
{
float.TryParse(spl[0], NumberStyles.Float, CultureInfo.InvariantCulture, out r);
float.TryParse(spl[1], NumberStyles.Float, CultureInfo.InvariantCulture, out g);
float.TryParse(spl[2], NumberStyles.Float, CultureInfo.InvariantCulture, out b);
}
r *= 255;
g *= 255;
b *= 255;
using (var cd = new ColorDialog { Color = Color.FromArgb((int)r, (int)g, (int)b) })
{
if (cd.ShowDialog() == DialogResult.OK)
{
r = cd.Color.R / 255f;
g = cd.Color.G / 255f;
b = cd.Color.B / 255f;
if (spl.Length < 3) spl = new string[3];
spl[0] = r.ToString(CultureInfo.InvariantCulture);
spl[1] = g.ToString(CultureInfo.InvariantCulture);
spl[2] = b.ToString(CultureInfo.InvariantCulture);
_textBox.Text = String.Join(" ", spl);
}
}
}
示例10: FormMain
public FormMain()
{
InitializeComponent();
float screenWidth = Screen.PrimaryScreen.Bounds.Width;
float screenHeight = Screen.PrimaryScreen.Bounds.Height;
width_ratio = (screenWidth / this.Width);
height_ratio = (screenHeight / this.Height);
SizeF scale = new SizeF(width_ratio, height_ratio);
//pbMain.Scale(scale);
//this.Size = pbMain.Size;
foreach (Control control in this.Controls)
{
if (control.Name == "pbMain")
continue;
control.Scale(scale);
}
foreach (Control control in this.Controls)
{
control.Font = new Font(control.Font.Name, control.Font.SizeInPoints * height_ratio * width_ratio, control.Font.Style);
}
level = new Level(pbMain.Width, pbMain.Height);
DrawBoard();
bPen = new Pen(Color.Black);
blackBrush = new SolidBrush(Color.Black);
blueBrush = new SolidBrush(Color.Blue);
redBrush = new SolidBrush(Color.Red);
whiteBrush = new SolidBrush(Color.White);
myBrush = new SolidBrush(Color.Black);
colorDialog = new ColorDialog();
myImage = new Bitmap(pbMain.Width, pbMain.Height);
}
示例11: buttonColor_MouseClick
private void buttonColor_MouseClick(object sender, MouseEventArgs e)
{
ColorDialog diag = new ColorDialog();
diag.ShowDialog();
Color col = diag.Color;
_matColor = new Microsoft.Xna.Framework.Graphics.Color(col.R, col.G, col.B, trackBarAlpha.Value);
}
示例12: selectcolor
public static int selectcolor(OptsType opts, ArgsType args)
{
ColorDialog d = new ColorDialog();
if (opts.ContainsKey("solid")) {
d.SolidColorOnly = true;
}
if (opts.ContainsKey("full")) {
d.AllowFullOpen = true;
}
else {
d.AllowFullOpen = false;
}
if (d.ShowDialog() != DialogResult.OK) {
return 1;
}
if (d.Color.IsKnownColor) {
Console.Out.WriteLine(d.Color.ToString());
}
else {
byte r = d.Color.R;
byte g = d.Color.G;
byte b = d.Color.B;
Console.Out.WriteLine(String.Format("#{0,2:x2}{1,2:x2}{2,2:x2}", r, g, b));
}
return 0;
}
示例13: btn_Click
private void btn_Click(object sender, EventArgs e)
{
Button btn = sender as Button;
if (btn == btnOtherColor)// 其他颜色
{
this.Deactivate -= new EventHandler(ColorPicker_Deactivate);// 取消因失去焦点而消失
ColorDialog colorDialog = new ColorDialog();
if (colorDialog.ShowDialog() == DialogResult.OK)
{
selectedColor = colorDialog.Color;
}
colorDialog.Dispose();
SelectedColorChanged(selectedColor, EventArgs.Empty);
}
else if (btn == btnScreenColor)// 屏幕取色
{
this.Deactivate -= new EventHandler(ColorPicker_Deactivate);// 取消因失去焦点而消失
GetScreenColorForm gscf = new GetScreenColorForm();
if (gscf.ShowDialog() == DialogResult.OK)
{
selectedColor = gscf.SelectColor;
}
gscf.Dispose();
SelectedColorChanged(selectedColor, EventArgs.Empty);
}
else if (btn != null)// 色块
{
selectedColor = btn.BackColor;
SelectedColorChanged(selectedColor, EventArgs.Empty);
}
}
示例14: ColorPanel_OnMouseLeftButtonUp
private void ColorPanel_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
var panel = sender as Border;
if (panel == null) return;
var colorDialog = new ColorDialog
{
Color = GetColor(panel.Background as SolidColorBrush),
FullOpen = true
};
if (colorDialog.ShowDialog() != DialogResult.OK) return;
var hexString = StringUtil.GetHexValue(colorDialog.Color);
var settings = DataContext as Settings;
if (settings == null) return;
if (panel.Name == "CitationTextBoxColorPanel")
{
settings.CitationTextBoxColor = hexString;
}
else if (panel.Name == "CitationFontColorPanel")
{
settings.CitationFontColor = hexString;
}
}
示例15: 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();
}
}