Jump to content
  • Advertisement
  • entries
    743
  • comments
    1924
  • views
    582778

Windows Forms and ImageLists

Sign in to follow this  
Aardvajk

246 views

So it appears that the ImageList property of MenuStrip and ToolStrips is disabled in C# Express, unless I am being very stupid.

It doesn't show up in the properties window for either control, and equally no ImageIndex property for tool buttons or menu items.

You can assign manually to the properties in code, and Intellisense happily suggests that they exist, but then tool bar images work and menu images don't.

Hey ho. Never mind. Found a question about it on the MS forums but no-one had answered it. I appreciate that this is free software and am not complaining, but I wish that they would at least document what they have and haven't disabled.

Time to give up on C# for a bit anyway as I want to start my next game.
Sign in to follow this  


4 Comments


Recommended Comments

Using an ImageList and an ImageIndex to control images is no longer the done thing with the ToolStrip series of controls (which are new for .NET 2.0, though .NET 1.x's controls, such as the ToolBar class, are still available for backwards compatibility reasons). Now you can just set the Image property to control the button image, which is available from the designer.

EDIT: As to your query below regarding DirectX; you do need to install the SDK to be able to add the various referenced components you need to use. It might be worth looking into XNA Game Studio Express though as an alternative to MDX, at the moment.

Share this comment


Link to comment
Aaaah. Right. That makes sense. My apologies to Microsoft for the comment above about not documenting restrictions. No idea what I am talking about, as usual.

Not that I care with 16x16 bitmaps, but if I wanted to centralise an image to be used by several buttons, I guess I need to add it as a resource to the project then load it into the button as a resource? I assume then any updates to the image would be reflected in all the buttons that used it?

Something I really miss from Borland Builder is the ActionList component. You created a TAction, that could be assigned an image list and image index, a title, a hint and obviously a method. Every other component like tool bar buttons, menu items and normal buttons etc then have an Action property that you just assign a TAction from the list to.

You can then at runtime, for example, set the Action's enabled property to false and have that instantly reflected in all of the components whose action is assigned to it, or change the hint at design time and have it propogate out to all the controls that linked to it.

Very nice. Is there any similar functionality avaialble in VS C#?

Share this comment


Link to comment
Quote:
Original post by EasilyConfused
Not that I care with 16x16 bitmaps, but if I wanted to centralise an image to be used by several buttons, I guess I need to add it as a resource to the project then load it into the button as a resource? I assume then any updates to the image would be reflected in all the buttons that used it?
When you click the […] button to load an image it pops up a browser allowing you to pick an image from the resource file or to add a new one. If you edit the file externally (or using the resource editor) the changes will propogate through the application. However, I'm not so sure that changing the resource at run time would propogate any changes.

As for the second query, I'm not sure if something like that exists. It would be convenient (such as where you have a toolbar button that is a shortcut to a menu button). You could set up the menu structure neatly, then on the toolbar buttons simply call the .PerformClick() method to simulate clicking on a menu item. This doesn't help with enabling/disabling of menu items though.

The sort of thing to look into is the ToolStripManager class for, well, managing tool strips.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!