Dynamic Controls...how to ID?

D

doogman

I have wrote my own icon class that places a bmp and two lines of text onto
a panel. These icons's are created dynamically and represent positions on a
map. I want to be able to click on the icon and use the icon as an index to
the data it represents. IE. click on it using a contextmenu and be able to
edit, move, and delete the icon.

I am able to actually put it on screen, add the contextmenu and select its
events, but my question is how do I know what the ControlNo is for the icon
I am selecting in the panelField.Controls list?

Should I create an array to store these controls in? And again how would I
be able to extract the Icon no in the ArrayList so that I can delete it
from the array, etc.? Basically touch that specific icon object in the
heap...

Thanks as always peoples....

doogman
 
A

Alex Feinman [MVP]

One of the solutions would be to store data in the Hastable using the Icon
as a key. Underneath the Hastable uses object address in memory, so this
gives you reasonably fast binary search. The Hashatble items will be the
objects associated with icons
 

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