I use the List construct to handle the sequence in which images are drawn in "OnPaint". Now, if my images are reordered (for example, "brought to the front" or ".. back"), I will need to move them to my list. I have problems with this because List does not support a method similar to setIndex () .
So what I am trying to do is basically:
private List<BitmapWithProps> activeImages = new List<BitmapWithProps>(); public void addActiveImage(BitmapWithProps image) { activeImages.Add(image); } public BitmapWithProps getActiveImage(int index) { return activeImages[index]; } public void removeActiveImage(int index) { activeImages.RemoveAt(index); } public void removeActiveImage(BitmapWithProps item) { activeImages.Remove(item); } public void swapActiveImageIndex(int sourceIndex, int destIndex) {
I want to be able to change the index. I could “insert” a new element into the list at the index into which it should go, and assign a value, and then delete another “source”. However, this in no way looks elegant.
I would welcome any hints and please excuse me if I missed a thread - I really searched before asking.
Ds.
source share