Application.EnableVisualStyles and no image in Tab control

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.
 
H

Herfried K. Wagner [MVP]

#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'.
 
M

Mick Doherty

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.
 
R

Rodger Constandse

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top