Application.EnableVisualStyles and no image in Tab control

  • Thread starter Thread starter #ROBERT
  • Start date Start date
R

#ROBERT

(VS 2003 + .NET Framework 1.1 + WinXP Pro SP2)

Calling Application.EnableVisualStyles() after the initialization() removes
all images in the tab control (in the tab headers I mean). Without visual
styles enabled, I have no
problem. What is wrong and what is the solution?
(PS: Using a manifest file makes no trouble. just the function :
Application.EnableVisualStyles() )

Thanks for any help.
 
#ROBERT said:
Calling Application.EnableVisualStyles() after the initialization()
removes
all images in the tab control (in the tab headers I mean). Without visual
styles enabled, I have no
problem. What is wrong and what is the solution?

Call 'Application.DoEvents' directly after calling 'EnableVisualStyles'.
 
Application.EnableVisualStyles and Application.DoEvents must be called in
Sub Main(), not Sub New()

i.e.
\\\
Shared Sub Main
Application.EnableVisualStyles
Application.DoEvents
Application.Run (New Form1)
End Sub
///

Alternatively, populate the imagelist during or after form load, or add a
manifest resource to the exe after you have built it.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html


#ROBERT said:
No way... it is just the same.
 
I've experienced a lot of weird problems using EnableVisualStyles (with or
without calling DoEvents afterwards), including a mysterious
'System.Runtime.InteropServices.SEHException' exception.

Just use the manifest file.
 
Back
Top