Toolbar images don't display

  • Thread starter Michael J. Salamone
  • Start date
M

Michael J. Salamone

I have some strange behavior with toolbar images - will do my best to
describe - hope someone can help!

I have several toolbars in my application. I assign each toolbar button an
image at design time - and they all display correctly in the designer.
However, when I run the program, some toolbar images are displayed, and
others are "blank" - no image displayed. The tooltips do display, though.

On each toolbar, either all the images are displayed correctly, or all are
blank.

The main form has several tabs. Each tab has associated listviews,
treeviews, etc - and toolbars. When the app starts, there is code to
restore splitters and column widths settings for each listview.

On the particular tab that has the problem, the preferences are restored
after the call to InitializeComponent(). If, immediately after the call to
restore preferences I add a message box, all the toolbar images are
displayed correctly. Without even changing the code - just breaking on the
call to MessageBox, and then setting the instruction pointer immediately
after it - no toolbar images :( If I execute the MessageBox statement -
voila - toolbar images!

It's a bit bizarre, and I'm not sure where to go with it. I'd appreciate
any suggestions on things to check, a good strategy to debug, or even just a
way to narrow down the problem!

This is how the code goes:

InitializeComponent();
EnableDisableControls(); // disables or enables controls - including
toolbars
RestorePreferences(); // restore listview column widths, splitters
MessageBox();

I've tried skipping both EnableDisableControls and RestorePreferences
calls - to no avail. It's the call to MessageBox() that seems to be the
magic bullet.
 
M

Michael J. Salamone

Yes.

--
Michael Salamone [eMVP]
Entrek Software, Inc.
www.entrek.com


Neno Loje said:
Are you using Windows XP Themes?

--
Neno Loje [MVP C#]
http://www.dotnet-online.com

Michael J. Salamone said:
I have some strange behavior with toolbar images - will do my best to
describe - hope someone can help!

I have several toolbars in my application. I assign each toolbar button
an image at design time - and they all display correctly in the designer.
However, when I run the program, some toolbar images are displayed, and
others are "blank" - no image displayed. The tooltips do display,
though.

On each toolbar, either all the images are displayed correctly, or all
are blank.

The main form has several tabs. Each tab has associated listviews,
treeviews, etc - and toolbars. When the app starts, there is code to
restore splitters and column widths settings for each listview.

On the particular tab that has the problem, the preferences are restored
after the call to InitializeComponent(). If, immediately after the call
to restore preferences I add a message box, all the toolbar images are
displayed correctly. Without even changing the code - just breaking on
the call to MessageBox, and then setting the instruction pointer
immediately after it - no toolbar images :( If I execute the MessageBox
statement - voila - toolbar images!

It's a bit bizarre, and I'm not sure where to go with it. I'd appreciate
any suggestions on things to check, a good strategy to debug, or even
just a way to narrow down the problem!

This is how the code goes:

InitializeComponent();
EnableDisableControls(); // disables or enables controls - including
toolbars
RestorePreferences(); // restore listview column widths,
splitters
MessageBox();

I've tried skipping both EnableDisableControls and RestorePreferences
calls - to no avail. It's the call to MessageBox() that seems to be the
magic bullet.
 
M

Michael J. Salamone

Yes, but it doesn't seem to be related to that.

I have a .manifest file (contents below). If I rename the file such that it
doesn't apply the XP themes, the same problem occurs.


..manifest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="Microsoft.Winweb.nyapp.exe"
type="win32"
/>
<description>myapp</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>



Neno Loje said:
Are you using Windows XP Themes?

--
Neno Loje [MVP C#]
http://www.dotnet-online.com

Michael J. Salamone said:
I have some strange behavior with toolbar images - will do my best to
describe - hope someone can help!

I have several toolbars in my application. I assign each toolbar button
an image at design time - and they all display correctly in the designer.
However, when I run the program, some toolbar images are displayed, and
others are "blank" - no image displayed. The tooltips do display,
though.

On each toolbar, either all the images are displayed correctly, or all
are blank.

The main form has several tabs. Each tab has associated listviews,
treeviews, etc - and toolbars. When the app starts, there is code to
restore splitters and column widths settings for each listview.

On the particular tab that has the problem, the preferences are restored
after the call to InitializeComponent(). If, immediately after the call
to restore preferences I add a message box, all the toolbar images are
displayed correctly. Without even changing the code - just breaking on
the call to MessageBox, and then setting the instruction pointer
immediately after it - no toolbar images :( If I execute the MessageBox
statement - voila - toolbar images!

It's a bit bizarre, and I'm not sure where to go with it. I'd appreciate
any suggestions on things to check, a good strategy to debug, or even
just a way to narrow down the problem!

This is how the code goes:

InitializeComponent();
EnableDisableControls(); // disables or enables controls - including
toolbars
RestorePreferences(); // restore listview column widths,
splitters
MessageBox();

I've tried skipping both EnableDisableControls and RestorePreferences
calls - to no avail. It's the call to MessageBox() that seems to be the
magic bullet.
 

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