我有字体对话框和颜色对话框,但是当我一次使用它时,我将无法再次使用它。
您能解释一下原因并告诉我如何解决吗?谢谢
我的代码:
private void button1_Click(object sender, EventArgs e)
{
if (fontDialog1.ShowDialog() == DialogResult.OK)
{
if (colorDialog1.ShowDialog() == DialogResult.OK)
{
Color color = colorDialog1.Color;
Brush brush = new SolidBrush(color);
Convert_to_image(textBox1.Text, fontDialog1.Font, brush);
}
}
}
答案 0 :(得分:0)
尝试一下:
private void button1_Click(object sender, EventArgs e)
{
fontDialog1 = new FontDialog();
if (fontDialog1.ShowDialog() == DialogResult.OK)
{
//[..]
}
}
并获取字体的颜色,您还可以尝试以下操作:
private void button1_Click(object sender, EventArgs e)
{
fontDialog1 = new FontDialog() {ShowColor = true};
if(fontDialog1.ShowDialog() == DialogResult.OK)
{
//[..]
}
}