Search code examples
delphidelphi-xe2vclwindow-resize

TCoolBar bands growing when resizing form


In a Delphi XE2 VCL Forms Application, I've placed a TCoolBar on the top of my main form. I've added two TCoolBands to this bar. Then I inserted a TToolBar into each of these two bands. Each toolbar has a few buttons.

The problem is, when I'm resizing my form horizontally (both in design-time and run-time), the bands grow in width, regardless of if I'm making the form larger or smaller. Even when making my form smaller, the bands grow, until the second one is eventually pushed out of view.

Why does this happen and how do I stop it from happening?


Solution

  • AFAIK, the only solution (thanks to Ludek Stauber) is to patch Vcl.ComCtrls.pas. At the end of method TCoolBar.GetCaptionSize add the two lines to handle IE6 and newer:

      { The grip size in IE4 is 3 pixels narrower than IE3 }
      if GetComCtlVersion < ComCtlVersionIE4 then
        Inc(Result, GripSizeIE3)
      // begin handle IE6
      else if GetComCtlVersion >= $0006000A {ComCtlVersionIE610} then
        Inc(Result, 4 {GripSizeIE610})
      // end handle IE6
      else