Display a single frame from a multipage TIFF file from a listbox in a picture box
I have created a C# application which allows you to load a multipage TIFF file and displays them in a listbox. There are then buttons that you can add and remove pages and save the new image file.
I have used the code from here Adding frames to a Multi-Frame TIFF and just changed a few bits so that it suits my application.
The problem is that the images are not legible as the size of the loaded image is too small.
What I would like to do is click on the listbox image and have it display in a larger size in a picture box (or another similar option if better) - allowing the user to decide if they want to remove it...
When I have looked in to this the picture box seems to want you to name a file - as开发者_Python百科 the file is the whole multipage image. This isn't right.
Either that or if I can display the images in the listbox in a legible format - at the moment as the multipages that are being loaded in are not always the same size the pages look squashed..
Please let me know if you need clarification on this question.
I've figured it out - this piece of code is already there:
private void listBox_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
{
if (this.listBox.Items.Count < 1)
return;
ImageItem i = (ImageItem)this.listBox.Items[e.Index];
e.Graphics.DrawImage(i.Image, e.Bounds, 0, 0, i.Image.Width, i.Image.Width, GraphicsUnit.Pixel);
}
So I linked up the listBox_Click,
private void listbox_Click(object sender, EventArgs e)
{
ImageItem i = (ImageItem)this.listbox.Items[listbox.SelectedIndex];
pictureBox.Image = i.Image;
}
so I took the object and put it in the picture box.
精彩评论