Search code examples
delphivcldelphi-xetcategorypanelgroup

CategoryPanelGroup No Header


Can anyone tell me how to prevent the TCategoryPanelGroup from drawing the headers. I've attempted to set the header.height to 0 but that creates and entirely new problem. My panels have TImages on them and when I scroll the panel group, graphic artifacts get drawn on the TImage.

Unfortunately, I don't appear to be able to post an image to show you so here's how to reproduce what I see.

  • New form. Drop a TCategoryPanelGroup on it, align client.
  • Add a new panel and drop a TImage on the panel, align left (you don't even have to load an image)
  • Copy and paste this panel several times into the PanelGroup
  • Set the TCategoryPanelGroup.HeaderHeight to 0.
  • Run the app.

Resize it so that you have a vertical scroll bar. Scroll the panels and if you're like me, you'll see some graphic artifacts where the TImage is.

TCategoryPanelGroup Img Artifacts

Here's a rough of what I'm trying to achieve.

enter image description here


Solution

  • To avoid the artefact you can override DrawHeader of TCategoryPanel

    type
      TCategoryPanel=Class(ExtCtrls.TCategoryPanel)
        procedure DrawHeader;override;
      End;
    
      TForm3 = class(TForm)
    //.........
    procedure TCategoryPanel.DrawHeader;
    begin
    //  inherited;
    
    end;