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

Date:January 6, 2006 / year-entry #12
Tags:code
Orig Link:https://blogs.msdn.microsoft.com/oldnewthing/20060106-35/?p=32743
Comments:    12
Summary: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...

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.


*DISCLAIMER: I DO NOT OWN THIS CONTENT. If you are the owner and would like it removed, please contact me. The content herein is an archived reproduction of entries from Raymond Chen's "Old New Thing" Blog (most recent link is here). It may have slight formatting modifications for consistency and to improve readability.

WHY DID I DUPLICATE THIS CONTENT HERE? Let me first say this site has never had anything to sell and has never shown ads of any kind. I have nothing monetarily to gain by duplicating content here. Because I had made my own local copy of this content throughout the years, for ease of using tools like grep, I decided to put it online after I discovered some of the original content previously and publicly available, had disappeared approximately early to mid 2019. At the same time, I present the content in an easily accessible theme-agnostic way.

The information provided by Raymond's blog is, for all practical purposes, more authoritative on Windows Development than Microsoft's own MSDN documentation and should be considered supplemental reading to that documentation. The wealth of missing details provided by this blog that Microsoft could not or did not document about Windows over the years is vital enough, many would agree an online "backup" of these details is a necessary endeavor. Specifics include:

<-- Back to Old New Thing Archive Index