本文整理汇总了C#中System.Windows.Forms.ColorDialog.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ColorDialog.ToString方法的具体用法?C# ColorDialog.ToString怎么用?C# ColorDialog.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ColorDialog
的用法示例。
在下文中一共展示了ColorDialog.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ColorDialogTest
public void ColorDialogTest ()
{
cd = new ColorDialog ();
Assert.AreEqual (Color.Black, cd.Color, "#1");
Assert.IsTrue (cd.AllowFullOpen, "#2");
Assert.IsFalse (cd.AnyColor, "#3");
Assert.IsFalse (cd.FullOpen, "#4");
Assert.IsNotNull (cd.CustomColors, "#5");
Assert.IsFalse (cd.ShowHelp, "#6");
Assert.IsFalse (cd.SolidColorOnly, "#7");
Assert.AreEqual ("System.Windows.Forms.ColorDialog, Color: Color [Black]", cd.ToString (), "#8");
cd.Color = Color.Red;
Assert.AreEqual (Color.Red, cd.Color, "#9");
cd.AllowFullOpen = false;
cd.FullOpen = true;
Assert.IsTrue (cd.FullOpen, "#10");
int[] custom_colors = new int[] {Color.Yellow.ToArgb (), Color.Red.ToArgb ()};
cd.CustomColors = custom_colors;
Assert.IsNotNull (cd.CustomColors, "#10a");
Assert.AreEqual (16, cd.CustomColors.Length, "#10aa");
Assert.AreEqual (Color.Red.ToArgb (), cd.CustomColors[1], "#10ab");
Assert.AreEqual (Color.FromArgb(0, 255, 255, 255).ToArgb (), cd.CustomColors[15], "#10ac");
cd.CustomColors = null;
Assert.IsNotNull (cd.CustomColors, "#10b");
Assert.AreEqual (16, cd.CustomColors.Length, "#10bb");
Assert.AreEqual (Color.FromArgb(0, 255, 255, 255).ToArgb (), cd.CustomColors[0], "#10bc");
cd.AllowFullOpen = true;
cd.CustomColors = custom_colors;
Assert.IsNotNull (cd.CustomColors, "#10c");
Assert.AreEqual (16, cd.CustomColors.Length, "#10cc");
}
示例2: button3_Click
private void button3_Click(object sender, EventArgs e)
{
colorDialog1 = new ColorDialog()
{
ShowHelp = true,
Color = textBox1.ForeColor
};
if (colorDialog1.ShowDialog() == DialogResult.OK)
_splashColourCode = colorDialog1.ToString();
}