G
Guest
I've noticed that calling DoEvents is much slower in an application that has called Application.EnableVisualStyles in Sub Main. Furthermore, the performance seems to worsen each time that DoEvents is called.
To demonstrate what I'm experiencing, create an app with a Sub Main, a Main Form, and a Button (called Button1). Include the following code in Sub Main:
Application.EnableVisualStyles
Application.DoEvents
Application.Run(New MainForm)
Now, include the following code in the Click event handler of Button1:
For i As Integer = 1 to 8000
Application.DoEvents
Next i
On my system the first time that I click Button1 takes ~0.92 seconds. Subsequent clicks take 1.35, 1.73, 2.12, and 2.52 seconds. But, if I now remove Application.EnableVisualStyles from Sub Main, then clicking Button1 only takes ~0.07 seconds (and the time does not increase if I continue to click Button1).
Is this a known issue? Is there a fix? Would it help to enable visual styles via a manifest file rather than calling EnableVisualStyles?
I'm using .NET Framework v1.1 on Windows XP Pro (SP1).
Thanks,
Lance
To demonstrate what I'm experiencing, create an app with a Sub Main, a Main Form, and a Button (called Button1). Include the following code in Sub Main:
Application.EnableVisualStyles
Application.DoEvents
Application.Run(New MainForm)
Now, include the following code in the Click event handler of Button1:
For i As Integer = 1 to 8000
Application.DoEvents
Next i
On my system the first time that I click Button1 takes ~0.92 seconds. Subsequent clicks take 1.35, 1.73, 2.12, and 2.52 seconds. But, if I now remove Application.EnableVisualStyles from Sub Main, then clicking Button1 only takes ~0.07 seconds (and the time does not increase if I continue to click Button1).
Is this a known issue? Is there a fix? Would it help to enable visual styles via a manifest file rather than calling EnableVisualStyles?
I'm using .NET Framework v1.1 on Windows XP Pro (SP1).
Thanks,
Lance