Why do image lists and tool bars use horizontal strips if vertical is so much better?


Two people pointed out that the ImageList_Add function and toolbars use horizontal strips even though we learned that vertical strips are much more efficient. While it's true that the images are passed to the ImageList_Add and CreateToolbarEx functions in horizontal strips, the image list and toolbar code copy them to a vertical strip.

In other words, the horizontal strip is merely an interchange format. Internally, the image list and toolbar use the more efficient vertical arrangement.

Comments (12)
  1. Matt says:

    I never liked pixel 3 much anyway

  2. Matt says:

    And 9 days after I decided I didn’t like pixels 1, 7, A or F either.

  3. Starfish says:

    Which prompts the question: why was it decided to use a horizontal strip in the first place? Logical for toolbars, though they run both ways, but irrelevant for image lists.

    Is it continuity – the toolbar arrangement was decided first, so the image list follows – or convention? (I can only remember ever seeing animations done horizontally in sprite sheets, for example, never vertically.)

  4. Name says:

    English language (and many others, like my russian) uses left-to-right order for writing. I think this is only one reason why all elements in GUI are aligned horizontally.

    BTW usual cinema film uses vertical frames moving.

  5. PatriotB says:

    Interestingly, CreateToolbarEx has been marked as obsolete in recent versions of the SDK documentation… wonder if there’s any specific reason for that?

  6. @Starfish, re: "I can only remember ever seeing animations done horizontally in sprite sheets, for example, never vertically".

    The Internet Explorer "throbber" – the animation up at the top right when a page is loading – is a vertical sequence of frames. See

    http://www.virtualplastic.net/html/logo_thr.html#throbber

    for details of how to customise it.

  7. Starfish says:

    @Nick: check the links in the post :)

  8. Spire says:

    Which prompts the question: why was it decided to use a horizontal strip in the first place?

    I’m guessing that it’s because most displays are wider than they are tall, making horizontal strips easier to edit than vertical ones.

  9. KJK::Hyperion says:

    PatriotB: you’re now supposed to use CreateWindowEx

  10. John Elliott says:

    I took a look at MFC 2.53, which does toolbars on Win16 where there is no native toolbar control. That seems to store images side-by-side (bartool.cpp lines 208-210) so it may be what the Win32 toolbar is being compatible with.

    On the other hand, MFC 2.53 is from April 1995, by which time Chicago betas existed; can someone confirm if CToolBar is the same in earlier MFCs?

Comments are closed.