I have font dialog and color dialog but when I use it once time then I cannot use it again.
Can you explain why and tell me how to fix it? Thanks
My code:
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);
}
}
}
Try this:
private void button1_Click(object sender, EventArgs e)
{
fontDialog1 = new FontDialog();
if (fontDialog1.ShowDialog() == DialogResult.OK)
{
//[..]
}
}
and to capture the colour for the font you could also try this:
private void button1_Click(object sender, EventArgs e)
{
fontDialog1 = new FontDialog() {ShowColor = true};
if(fontDialog1.ShowDialog() == DialogResult.OK)
{
//[..]
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.