472,986 Members | 2,876 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,986 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 4715
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?...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.