I have an application where the Font Dialog box does not appear until I
alt-tab away to another application, then alt-tab back to mine. Suddenly,
then it is visible. This also happens with the "File exists. Overwrite
Yes/No" message in the Save dialog box.
I am using VB.Net 2002 on Windows 2000.
I have reduced this down to a tiny sample application. Create a new
application, add a font dialog, two picture boxes, and a button. Then, use
the code supplied below. Run the application and click on the button to
display the Font Dialog box. But, the dialog box doesn't appear until you
alt-tab to another app, obscuring our program, then come back. Suddenly,
then the dialog box is visible. If you remove the Image.Clone code from the
Paint event, it works fine.
Note that the image I am using comes with Visual Studio.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim dlgResult As System.Windows.Forms.DialogResult
dlgResult = FontDialog1.ShowDialog(Me)
End Sub
Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
PictureBox1.Image = PictureBox2.Image.Clone
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
PictureBox2.Image = System.Drawing.Image.FromFile("C:\Program
Files\Microsoft Visual Studio .NET\Common7\Graphics\bitmaps\Gauge\HORZ1.BMP")
End Sub