本文整理汇总了C#中System.Windows.Forms.ColorDialog类的典型用法代码示例。如果您正苦于以下问题:C# ColorDialog类的具体用法?C# ColorDialog怎么用?C# ColorDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ColorDialog类属于System.Windows.Forms命名空间,在下文中一共展示了ColorDialog类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
}
开发者ID:jasmith152,项目名称:Notepad,代码行数:7,代码来源:Form1.cs
示例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;
}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:29,代码来源:FormSaveFileDialog.cs
示例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();
}
开发者ID:CharcoalStyles,项目名称:SHMUP,代码行数:33,代码来源:Form1.cs
示例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);
}
开发者ID:aniPerezG,项目名称:barbalpha,代码行数:26,代码来源:TgcColorModifier.cs
示例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);
}
}
}
}
开发者ID:AlexGaidukov,项目名称:gipertest_streaming,代码行数:29,代码来源:HintBackColor.cs
示例6: ApplyCustomColors
private void ApplyCustomColors(ColorDialog colorDialog)
{
if (customColors != null && customColors.Any())
{
colorDialog.CustomColors = customColors;
}
}
开发者ID:TargetProcess,项目名称:Tp.TrayUtility,代码行数:7,代码来源:ChangeColorControl.cs
示例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;
}
开发者ID:ShadyEM,项目名称:Twister3D,代码行数:7,代码来源:DataControl_Color3.cs
示例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;
}
开发者ID:nataliaheliova,项目名称:Diplomovka,代码行数:31,代码来源:Form1.cs
示例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);
}
}
}
开发者ID:silky,项目名称:sledge,代码行数:28,代码来源:SmartEditColor1.cs
示例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);
}
开发者ID:nullcat,项目名称:Level-Designer,代码行数:31,代码来源:Form1.cs
示例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);
}
开发者ID:hubris,项目名称:shaghal,代码行数:7,代码来源:GradientEditor.cs
示例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;
}
开发者ID:dyama,项目名称:fwfw,代码行数:30,代码来源:selectcolor.cs
示例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);
}
}
开发者ID:BattleNWar,项目名称:YDWE,代码行数:31,代码来源:ColorPicker.cs
示例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;
}
}
开发者ID:nus-fboa2016-PL,项目名称:PowerPointLabs,代码行数:25,代码来源:SettingsFlyout.xaml.cs
示例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();
}
}
开发者ID:lovelll,项目名称:YNDQHP,代码行数:32,代码来源:SymbolForm.cs
示例16: 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
示例17: SaveDefinedCustomColors
private void SaveDefinedCustomColors(ColorDialog colorDialog)
{
if (colorDialog.CustomColors != null && colorDialog.CustomColors.Any())
{
customColors = colorDialog.CustomColors;
}
}
开发者ID:TargetProcess,项目名称:Tp.TrayUtility,代码行数:7,代码来源:ChangeColorControl.cs
示例18: btnKolor_Click
public void btnKolor_Click(object sender, EventArgs e)
{
ColorDialog dialog = new ColorDialog();
dialog.Color = lblKolor.BackColor;
dialog.ShowDialog();
lblKolor.BackColor = dialog.Color;
}
开发者ID:donor,项目名称:Projects,代码行数:7,代码来源:MainWindow.cs
示例19: m_colorBox_Click
private void m_colorBox_Click(object sender, EventArgs e)
{
if (PropertyModel != null)
{
ColorDialog dialog = new ColorDialog();
PlayCanvas.Color color = PropertyModel.Data<PlayCanvas.Color>();
dialog.Color = Color.FromArgb(
0,
(int)(color.R * 255.0f),
(int)(color.G * 255.0f),
(int)(color.B * 255.0f)
);
if (dialog.ShowDialog() == DialogResult.OK)
{
color = new PlayCanvas.Color(
(float)dialog.Color.R / 255.0f,
(float)dialog.Color.G / 255.0f,
(float)dialog.Color.B / 255.0f,
color.A
);
PropertyModel.Data<PlayCanvas.Color>(color);
UpdateEditor();
}
}
}
开发者ID:PsichiX,项目名称:PlayGate,代码行数:25,代码来源:PlayCanvas_Rgb_PropertyEditor.cs
示例20: 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
注:本文中的System.Windows.Forms.ColorDialog类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论