Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. how to scrolling through "stacked" images?

how to scrolling through "stacked" images?

Scheduled Pinned Locked Moved C#
tutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ABean
    wrote on last edited by
    #1

    Does a control exist where I can load it with any number of images (one on top of the other) and then vertically scroll through them for viewing? My images will all be the same width but not the same height. I was thinking to host a webpage in my app and have local tags for the images but I don’t want the overhead. Any other ideas you would be great to have. Thanks!

    H 1 Reply Last reply
    0
    • A ABean

      Does a control exist where I can load it with any number of images (one on top of the other) and then vertically scroll through them for viewing? My images will all be the same width but not the same height. I was thinking to host a webpage in my app and have local tags for the images but I don’t want the overhead. Any other ideas you would be great to have. Thanks!

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      This would be a simple owner-drawn ListBox, for which several articles on this site already cover what you need to do (or alternatives, at least). Read ImageListBox - exposing localizable custom object collection as a property[^]. If covers a few things you didn't mention requiring, but the source will give you an idea. Basically, you just set DrawMode to DrawMode.OwnerDrawVariable (since they could be different heights, as you mentioned), and handle both the MeasureItem and DrawItem events. If you would actually be better, however, to extend ListBox with your own implementation (perhaps something like ImageListBox) that overrides the DrawMode property (always returns DrawMode.OwnerDrawVariable but does nothing or throws a NotSupportedException or something in the set accessor) and the OnMeasureItem and OnDrawItem methods (don't forget to call the base class's implementation so that events are fired). This is a far better approach because you won't have to implement all this code again every time you want to have an ImageListBox-like control, and overriding methods is faster than handling events. It's all about encapsulation.

      Microsoft MVP, Visual C# My Articles

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups