EtheaDev / StyledComponents

Components similar to Delphi VCL Buttons, Toolbar, DbNavigator, BindNavigator, ButtonGroup and CategoryButtons with Custom Graphic Styles, and an advanced, full-customizable TaskDialog, also with animations!
Apache License 2.0
152 stars 34 forks source link

Down arrow becomes invisible if button has property Flat set to True and Style set to bsSplitButton #7

Closed vectoris closed 8 months ago

vectoris commented 11 months ago

This needs to be fixed. If this is not a bug, then it should be possible to make this arrow visible.

carloBarazzetta commented 11 months ago

Try with those changes and give me a feed-back:

procedure TStyledButtonRender.DrawBackgroundAndBorder(
  const ACanvas: TCanvas;
  const AStyleAttribute: TStyledButtonAttributes);
var
  DrawRect, SplitButtonRect: TRect;
begin
  //Erase Background
  EraseBackground(ACanvas);

  //Don't draw button face for Flat Buttons
  if not (FFlat and (FState in [bsUp, bsDisabled]) and not (FMouseInControl)) or
    Focused then
  begin
    DrawRect := FOwnerControl.ClientRect;

    //Draw Button Shape
    CanvasDrawshape(ACanvas, DrawRect, FStyleDrawType, FStyleRadius);
  end;

  //Draw Bar and Triangle
  if FDropDownRect.Width > 0 then
  begin
    SplitButtonRect.Left := DrawRect.Width - FDropDownRect.Width;
    if FFlat then
      ACanvas.Pen.Style := psClear;
    CanvasDrawBarAndTriangle(ACanvas, FDropDownRect,
      {$IFDEF D10_3+}FOwnerControl.ScaleFactor{$ELSE}1{$ENDIF},
      ACanvas.Pen.Color, AStyleAttribute.FontColor);
  end;
end;
vectoris commented 10 months ago

These changes solve the problem.

carloBarazzetta commented 8 months ago

Fixed in 3.2.0 version