{"id":28233,"date":"2007-01-29T10:00:02","date_gmt":"2007-01-29T10:00:02","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2007\/01\/29\/if-vertical-strips-are-better-why-do-toolbars-use-horizontal-strips\/"},"modified":"2007-01-29T10:00:02","modified_gmt":"2007-01-29T10:00:02","slug":"if-vertical-strips-are-better-why-do-toolbars-use-horizontal-strips","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20070129-02\/?p=28233","title":{"rendered":"If vertical strips are better, why do toolbars use horizontal strips?"},"content":{"rendered":"<p>If <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2005\/08\/05\/448073.aspx\"> vertical strips are better<\/a>, <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2005\/08\/05\/448073.aspx#448127\"> why do toolbars use horizontal strips<\/a>?\n An early version of the toolbar control first made its appearance in Windows&nbsp;3.0, and in those days, screen resolutions were low and toolbar buttons were small. Horizontal or vertical didn&#8217;t really matter. Ten bitmaps, each 16 &times; 16, at 4-bit color, comes out to one kilobyte, much less than even a single 4KB page. (And what&#8217;s this paging nonsense anyway? We&#8217;re talking 16-bit Windows here!)\n When this code was ported to 32-bit Windows for Windows&nbsp;95, the existing bitmap format was preserved in order to retain compatibility with the 16-bit clients of the toolbar control. Windows&nbsp;95 included both the 16-bit and 32-bit versions of the common controls library, and they both built out of the same sources, with a little <code>#ifdef WIN32<\/code> action here and there to deal with the places where 16\/32 source code compatibility didn&#8217;t quite cover everything. The early prototypes of the Windows&nbsp;95 shell were written in this mixed 16\/32 model, so that the same program could be compiled either as a 16-bit program or a 32-bit program. The 16-bit version was used in the earlier builds because the 32-bit kernel, GDI, and USER were all being developed in parallel. The 16-bit version went out in the builds, and the 32-bit version was used by the development team as a proving ground for Windows&nbsp;95&#8217;s 32-bit computing environment. When the 32-bit environment was declared &#8220;good enough to self-host&#8221;, the switch was thrown, and the 32-bit shell went into the builds instead of the 16-bit shell.\n All this is a long way of saying that source code compatibility between 16-bit code and 32-bit code was very important, not only within the Windows&nbsp;95 shell team, but throughout the Windows&nbsp;95 product, so that teams could port their 16-bit components to 32-bit in a gradual and evolutionary manner. If you were to introduce gratuitous subtle differences (like the orientation of bitmap strips in toolbars), you wouldn&#8217;t make many friends. They would port their program to 32-bit Windows and the toolbars would all come out funny. &#8220;But it works fine when I compile it as 16-bit. Must be a bug in Windows&nbsp;95. I&#8217;ll wait for the next build and try again.&#8221;\n With the introduction of version&nbsp;4.70 of the common controls, the internal structure of the toolbars changed, and the bitmaps came to be <a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/shellcc\/platform\/commctls\/toolbar\/messages\/tb_setimagelist.asp\"> stored as imagelists<\/a> rather than as raw bitmaps. Imagelists store their images in a vertical strip, so once again all is well with the world.\n &#8220;Why not add a <code>TB_ADDVERTICALBITMAP<\/code> message?&#8221;\n Well, for one thing, you&#8217;re looking for inefficiency at the wrong level. All that happens with the bitmap is that it gets stuffed into an imagelist. Nobody actually draws out of it, so there&#8217;s no point in optimize it for drawing.\n And for another thing, you&#8217;re looking for inefficiency at the wrong level. If this even shows up on your performance traces, it means that you&#8217;re spending your time loading images into toolbars. Isn&#8217;t that a bigger cause for concern, that you&#8217;re spending so much of your time setting up toolbars? Shouldn&#8217;t you be spending your time doing productive work?<\/p>\n<p> (<a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2006\/01\/06\/510066.aspx#510111\">Imagelists? Use your imagination<\/a>.) <\/p>\n","protected":false},"excerpt":{"rendered":"<p>If vertical strips are better, why do toolbars use horizontal strips? An early version of the toolbar control first made its appearance in Windows&nbsp;3.0, and in those days, screen resolutions were low and toolbar buttons were small. Horizontal or vertical didn&#8217;t really matter. Ten bitmaps, each 16 &times; 16, at 4-bit color, comes out to [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-28233","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>If vertical strips are better, why do toolbars use horizontal strips? An early version of the toolbar control first made its appearance in Windows&nbsp;3.0, and in those days, screen resolutions were low and toolbar buttons were small. Horizontal or vertical didn&#8217;t really matter. Ten bitmaps, each 16 &times; 16, at 4-bit color, comes out to [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/28233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=28233"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/28233\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=28233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=28233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=28233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}