Displaying thumbnail icons 128x128 pixels or larger in a grid in ListView

后端 未结 5 560
栀梦
栀梦 2020-12-07 20:39

Original Question (see Update below)

I have a WinForms program that needs a decent scrollable icon control with large icons (128x128 or larger thumbnails, really)

相关标签:
5条回答
  • 2020-12-07 20:45

    Disclaimer: I work for Atalasoft

    There is an image thumbnail control in our .NET Imaging SDK, DotImage

    0 讨论(0)
  • 2020-12-07 20:47

    Making a custom control wouldn't be too bad. I would inherit from Panel or a Usercontrol as I believe both automatically add scrollbars for the content.

    Dynamically adding containers (like PictureBoxes) and captions for each image, handling the mousedown or mouseclick event for the container and perhaps drawing a red square around it to show that it is selected. The "hardest" part would be resampling the image to 128x128 if they are not already that size and even that can easily be with GDI+.

    0 讨论(0)
  • 2020-12-07 21:02

    ObjectListView (an open source wrapper around a .NET ListView) makes it easy to custom draw a Tile view. Have a look at the Complex view on the demo, switch to Tile view when custom draw is enabled:
    (source: sourceforge.net)

    If you only wanted a 128x128 image plus some text details, you wouldn't even need to owner draw it. You could give it a large imagelist, and then mark which bits of textual information you wanted to show on the Tile, using IsTileViewColumn.

    0 讨论(0)
  • 2020-12-07 21:05

    For update:

    1. Set image list color depth in addition to image size (ilist.ColorDepth = ColorDepth.Depth24Bit)
    2. WinForms ListView does not have possibility to change icon spacing, however it can be easily done using Win32. You need to send LVM_SETICONSPACING to your ListView (there is a lot of tutorials how to use SendMessage win32 function in .net, so I think this direction must be enough for you).
    0 讨论(0)
  • 2020-12-07 21:12

    You could use the FlowLayoutPanel and drop pictureboxes in it. Set the picturebox to a size of 128x128 and the sizemode to 'zoom' (This takes care of resizing your image without loss of aspect ratio). You can even programatically add the pictureboxes.

    PictureBox pb = New Picturebox;
     pb.image = gcf.image128;
     FlowLayoutPanel1.Controls.Add(pb)
    

    Since you need to have a label under the picturebox, you could create a Usercontrol like Pastor said that all it has is a picturebox and a label under it. Then that would be the control instance you would add to your flowlayoutpanel.

    0 讨论(0)
提交回复
热议问题