473,804 Members | 3,697 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Toolbar's, ImageLists, and Manifest Resources

I have encountered a problem (most certainly a .NET bug), that, for the
life of me, I cannot figure out how to work around.

Using Visual Studio 2003, with enabled XP Visual Styles.

There are two possible scenarios here, the first one works properly,
while the 2nd one doesn't.

Scenario 1
----------
* Application opens with a notifyicon instead of a form window.

* User double clicks the notifyicon to show the main form window

* The main form window properly displays the toolbar buttons with
their respective images from the assigned ImageList. The ImageList is
populated from calls to
Assembly.GetExe cutingAssembly( ).GetManifestRe sourceStream("n s.file.ext")
-----------

Scenario 2
----------
Everything is the same as in Scenario 1, except for the following:

* Application opens with a notifyicon, same as above.

* A Timer event triggers the opening of another form window, and the
user has *not* double clicked the notifyicon to open the "main" window.
* When double clicking the notifyicon and opening the main form window,
the buttons on the toolbar do not display their images. They are
blank. This is the problem.
-----------

Also, If there is a timer tick that triggers the secondary window AFTER
the user has already opened and closed the main window, and the user
procedes to open the main window again, everything still displays as it
should.

Other than forcing the main window to open (which I do not want to do),
I absolutely cannot find a workaround for this problem. I have been
trying absolutely everything that I can think of for hours to no avail.
Any insight would be appreciated.

Nov 16 '05 #1
5 3244
How are you starting the App with a NotifyIcon?
When are you loading the ImageList?
Are visual styles actually Enabled?

I just built a quick test project starting my app with an
ApplicationCont ext.
I fill the ImageList in the Forms load method.
I showed the form by DoubleClicking on the NotifyIcon and all was well.

I restarted the App and allowed a Timer to show the Form.
Visual Styles were not Enabled, but the Images showed up on the Toolbar
Buttons.

I then removed the EnableVisualSty les and DoEvents calls and added a
Manifest Resource to the project.
Visual Styles are now enabled and the Icons display just fine in the toolbar
whether the form is loaded by doubleClick or timer.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
<an***********@ gmail.com> wrote in message
news:11******** **************@ l41g2000cwc.goo glegroups.com.. .
I have encountered a problem (most certainly a .NET bug), that, for the
life of me, I cannot figure out how to work around.

Using Visual Studio 2003, with enabled XP Visual Styles.

There are two possible scenarios here, the first one works properly,
while the 2nd one doesn't.

Scenario 1
----------
* Application opens with a notifyicon instead of a form window.

* User double clicks the notifyicon to show the main form window

* The main form window properly displays the toolbar buttons with
their respective images from the assigned ImageList. The ImageList is
populated from calls to
Assembly.GetExe cutingAssembly( ).GetManifestRe sourceStream("n s.file.ext")
-----------

Scenario 2
----------
Everything is the same as in Scenario 1, except for the following:

* Application opens with a notifyicon, same as above.

* A Timer event triggers the opening of another form window, and the
user has *not* double clicked the notifyicon to open the "main" window.
* When double clicking the notifyicon and opening the main form window,
the buttons on the toolbar do not display their images. They are
blank. This is the problem.
-----------

Also, If there is a timer tick that triggers the secondary window AFTER
the user has already opened and closed the main window, and the user
procedes to open the main window again, everything still displays as it
should.

Other than forcing the main window to open (which I do not want to do),
I absolutely cannot find a workaround for this problem. I have been
trying absolutely everything that I can think of for hours to no avail.
Any insight would be appreciated.

Nov 16 '05 #2
This is my main() method:

static void Main()
{
System.Windows. Forms.Applicati on.EnableVisual Styles();
System.Windows. Forms.Applicati on.DoEvents();
Loader load = new Loader();
System.Windows. Forms.Applicati on.Run();
}

Loader() then loads the notifyicon in its constructor and sets up its
click events and menu. The main form is also instantiated in the
Loader() constructor.

The ticker is a variable in the Loader() class, and is initialized on
declaration in the class header.

The main form loads the toolbar buttons from the manifest resource
stream in its OnLoad event. I have also tried arranging this to load
up the toolbar button images in the forms instantiation, but that does
not work, either.

Note that I have created a PictureBox and used the manifest resource
stream to grab one of the icons and display it in the picture box
successfully - in the same OnLoad() method, while it didn't display in
the toolbar button.

If I'm being unclear in anything, the full source code and application
can be obtained on source forge - http://sf.net/projects/ontime

Nov 16 '05 #3
Looks like Application.Ena bleVisualStyles is doing nothing when your app
loads a form via the timer, as can be seen by looking at the radio buttons
and checkboxes on your config form.

Remove the calls to EnableVisualSty les and DoEvents from your main() method.
Rebuild your app.
Open OnTime.Exe with Visual Studio.
Import a *.manifest file into the resource table (Resource Type =
RT_MANIFEST)
Change the Id from 101 to 1.

The downside to this method is that you must add the manifest resource every
time you rebuild the app, but visual styles will work and your Icons will
show in the toolbar.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
<an***********@ gmail.com> wrote in message
news:11******** *************@z 14g2000cwz.goog legroups.com...
This is my main() method:

static void Main()
{
System.Windows. Forms.Applicati on.EnableVisual Styles();
System.Windows. Forms.Applicati on.DoEvents();
Loader load = new Loader();
System.Windows. Forms.Applicati on.Run();
}

Loader() then loads the notifyicon in its constructor and sets up its
click events and menu. The main form is also instantiated in the
Loader() constructor.

The ticker is a variable in the Loader() class, and is initialized on
declaration in the class header.

The main form loads the toolbar buttons from the manifest resource
stream in its OnLoad event. I have also tried arranging this to load
up the toolbar button images in the forms instantiation, but that does
not work, either.

Note that I have created a PictureBox and used the manifest resource
stream to grab one of the icons and display it in the picture box
successfully - in the same OnLoad() method, while it didn't display in
the toolbar button.

If I'm being unclear in anything, the full source code and application
can be obtained on source forge - http://sf.net/projects/ontime

Nov 16 '05 #4
Mick,
That only happens when the timer event is the first thing to show a
form window. In my personal code, I overcame that by initializing
frmMain() in Loader's constructor, instead of when it was first being
shown. The EnableVisualSty les() also seems to be affected by this
whole weird form issue in this regard. I was able to work around that,
but I still haven't been able to work around the button images....

Nov 16 '05 #5
Adding a Manifest Resource only takes seconds and will fix it.

If you don't want to do that, then you'll have to make your ImageList a
global variable, instead of local to the form, and then assign the imagelist
to the toolbar in the load event.
In your Main() method you need to Initialize a new FrmMain, Initialize and
fill the imagelist, then show and hide/dispose the FrmMain.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
<an***********@ gmail.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
Mick,
That only happens when the timer event is the first thing to show a
form window. In my personal code, I overcame that by initializing
frmMain() in Loader's constructor, instead of when it was first being
shown. The EnableVisualSty les() also seems to be affected by this
whole weird form issue in this regard. I was able to work around that,
but I still haven't been able to work around the button images....

Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1638
by: desa | last post by:
If I call EnableVisualStyles none the images in my ImageLists show up in my controls anymore. Is this a known issue? How do I fix this? I'm using VS.NET 2003.
3
3237
by: Jonathan Payne | last post by:
Hi, I am interested in adding a manifest file to the resources for a MFC application. When I create an AppWizard MFC app with a manifest file it adds the following lines to the .rc file: #ifdef _UNICODE IDR_MANIFEST RT_MANIFEST "res\\TestManifest4.manifest"
3
2584
by: Tom wilson | last post by:
Resources 'Beneficiary.aspx.resx' and 'OveraAge.aspx.resx' have the same manifest resource name 'Enroll.Beneficiary.resources'. Umm... what's this mean? The first two are aspx page resource files. I don't know what Enroll.Beneficiary.resources is, I don't have a page by that name. The entire project is called Enroll. What's VS talking about? Thanks!
2
1471
by: Jean-Francois Cantin | last post by:
I used a toolbar with an imagelist. When my devenv.exe file had an associated manifest file, disabled images in this toolbar was shown with grayscale colors. I'm trying to remove the manifest file ( I have some problems with Windows 98 ), but when I recreate the imagelist control, the toolbar doesn't show grayscale colors buttons anymore. How can I resolve it ? Thank's
3
2475
by: Al | last post by:
Hi All, I am trying to get a 24x24 "Windows XP" icon to display correctly on a button in my toolbar. My icon has 8 layers (16x16, 16x16, 24x24, 24x24, 32x32, 32x32, 48x48, 48x48) with each size having a 256 and windows xp colored image. When my application runs, the icon with 256 colors appears rather than the xp icon. I have tried using a manifest as well as Application.EnableVisualStyles. No luck. I have seen numerous articles...
9
1217
by: Bill English | last post by:
I have a problem with my toolbar images. I seem to have set them up correctly, because they show up perfectly in the designer, but when I run it the images do not appear. Here is a picture of the designer: http://68.34.190.119/images/VS%20Problem.bmp
9
1801
by: Hugh | last post by:
after I changed the image size. I tried different combinations of images sizes and button sizes. I have tried both botton and the image in the same sizes or button size was larger than that of image. The images were still invisible. What is the trick? I asked this question a while ago. Thanks.
1
1010
by: Mitchell Vincent | last post by:
I've had this problem for a week, and it's just now getting to where I can't work on a project because of it. Every single project I load up in VS.NET 2003 that has an imagelist in it gives me a compile error "'System.Reflection.TargetInvocationException' occurred in mscorlib.dl" on lines like "Me.imgAppointments.ImageStream = CType(resources.GetObject("imgAppointments.ImageStream"), System.Windows.Forms.ImageListStreamer)"
14
5921
by: _iycrd | last post by:
After several frustrating attempts to wrap a native DLL w a C++/CLI DLL, I finally got an assembly to compile, only to find a *runtime* error. The app comes up fine. Test dialog displays. Clicking on the button that creates the wrapper class causes an exception, not in the button's event handler, but in Application.Run() within Main(). The error: ! System.IO.FileNotFoundException was unhandled Message="The specified module could not...
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10577
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10077
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9150
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5521
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2991
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.