473,378 Members | 1,578 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Update Pictures in ImageList Component

I'm using a ListView control to display pictures similarly to how
Windows Explorer displays pictures in "Thumbnails" view. The images are
stored in an ImageList component. I would like to provide the ability
to rotate the images and I'm having some issues.

Basically, what I've tried is:

lstViewImages.LargeImageList.Images[ItemIndex].RotateFlip(RotateFlipType.Rotate90FlipNone);
lstViewImages.Update();

And:

imageListThumbNails.Images[ItemIndex].RotateFlip(RotateFlipType.Rotate90FlipNone);
lstViewImages.Update();

Obviously, the first approach accesses the ImageList component through
the ListView control, whereas the second approach accesses the ImageList
component directly. The code should, in theory, rotate the image in the
ImageList component; however, viewing the image after calling the
RotateFlip() method displays the image in its original position.

I considered removing the original image and adding it again, but that
wasn't a viable solution because the imageListThumbNails.Images
collection does not provide an Insert() method that I could use to
specify the exact index that I wish the update image to be inserted. In
other words, I could only Add() the image to the end of the collection,
which would reorder everything.

Am I doing something wrong or is there another approach I should look into?

Thank you in advance,

--
Sean
Dec 13 '06 #1
2 4810
Hi Sean,

The ImageList.Images collection's indexer is read/write:

Image image = imageListThumbNails.Images[ItemIndex];
image.RotateFlip(RotateFlipType.Rotate90FlipNone);

// refresh the image within the ImageList
imageListThumbNails.Images[ItemIndex] = image;

// Update only works if some region has been invalidated.
// Calling Refresh does both: invalidate and update
lstViewImages.Refresh();

--
Dave Sexton

"senfo" <en**********@yahoo.comI-WANT-NO-SPAMwrote in message
news:uh*************@TK2MSFTNGP02.phx.gbl...
I'm using a ListView control to display pictures similarly to how Windows
Explorer displays pictures in "Thumbnails" view. The images are stored in
an ImageList component. I would like to provide the ability to rotate the
images and I'm having some issues.

Basically, what I've tried is:

lstViewImages.LargeImageList.Images[ItemIndex].RotateFlip(RotateFlipType.Rotate90FlipNone);
lstViewImages.Update();

And:

imageListThumbNails.Images[ItemIndex].RotateFlip(RotateFlipType.Rotate90FlipNone);
lstViewImages.Update();

Obviously, the first approach accesses the ImageList component through the
ListView control, whereas the second approach accesses the ImageList
component directly. The code should, in theory, rotate the image in the
ImageList component; however, viewing the image after calling the
RotateFlip() method displays the image in its original position.

I considered removing the original image and adding it again, but that
wasn't a viable solution because the imageListThumbNails.Images collection
does not provide an Insert() method that I could use to specify the exact
index that I wish the update image to be inserted. In other words, I
could only Add() the image to the end of the collection, which would
reorder everything.

Am I doing something wrong or is there another approach I should look
into?

Thank you in advance,

--
Sean

Dec 13 '06 #2
Dave Sexton wrote:
Hi Sean,

The ImageList.Images collection's indexer is read/write:

Image image = imageListThumbNails.Images[ItemIndex];
image.RotateFlip(RotateFlipType.Rotate90FlipNone);

// refresh the image within the ImageList
imageListThumbNails.Images[ItemIndex] = image;

// Update only works if some region has been invalidated.
// Calling Refresh does both: invalidate and update
lstViewImages.Refresh();
That did the trick. I'm not sure how I missed the indexer being
read/write. Also, thank you for pointing out the Refresh() method. I
hadn't realized that.

Thank you very much,

--
Sean
Dec 13 '06 #3

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

Similar topics

0
by: alex n | last post by:
hello. it was fine to have system image list class/component in C++/Delphi in old times. you can obtain just image index for file with shell and your list/treeview already draw file icon. but...
2
by: Bob C. | last post by:
Hi All, I am using the ImageList/ListView Components to display around 100 images in C#.NET. The issue i have is, some times i may need to display the thumbnail of size more then 256x256 in...
2
by: Xarky | last post by:
Hi, I am writing a windows application. To my form I have added a ToolBar componenet and have created a collection of buttons within it. I have also created an ImageList, where I have loaded the...
6
by: Stephen Costanzo | last post by:
In the code below I receive an exception error because the target file is being used by another process. I know this to be false because the target doesn't exist. It seems like the application...
5
by: Vittorio Pavesi | last post by:
Hello, I'm experiencing error displaying PNG images with transparent background using ImageList; the picture is displayed in a wrong way. Picturebox doesn't seem to be affected by this problem. I...
6
by: henrycortezwu | last post by:
Hi, I have a WinXPSP2, P4 3.2GHZ, 1GIG RAM on my dev machine using VS2005 VB.NET. I did the following procedure: 1. Added 82 icons (128x128 in size & 32bit Depth) in an imagelist control 2....
2
by: senfo | last post by:
I'm using an ImageList component in conjunction with a ListView control to display images and it appears as though it's only possible set the size of an image globally, for the entire list. Is...
0
by: gene kelley | last post by:
(using VS2005) I want to add an icon to TreeView nodes. 1) To a new project (VB or C#) I add a sample TreeView with some sample nodes. I add an ImageList component, and add one icon image. I...
60
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I prompt a "Save As" dialog for an accepted mime type?...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.