DrawButton

procedure DrawButton(img: TImage32; const pt: TPointD; size: double; color: TColor32 = clNone32; buttonOptions: TButtonOptions = []);


Buttons are very useful things. They can mark points of interest or used as dynamic controls in graphic design. DrawButton simplifies button drawing (shape, sizing, fill, outline, shadow and 3D effect) into a single procedure.


  uses Image32, Image32_PNG,
    Image32_Draw, Image32_Extra;
  ...
  var
    i,j: integer;
    img: TImage32;
    path: TPathD;
  begin
    img := TImage32.Create(256, 256);
    
    //draw round uncolored buttons
    j := 15;
    for i := 3 to 12 do
    begin
      DrawButton(img, PointD(j, 100), i*2,
        clNone32, [boDropShadow]);
      inc(j, 10 + i*2);
    end;

    //and draw some colored square buttons
    j := 15;
    for i := 3 to 12 do
    begin
      DrawButton(img, PointD(j, 180), i*2,
        AdjustHue(clRed32, (i- 3) * 10),
        [boSquare, boDropShadow]);
      inc(j, 10 + i*2);
    end;

    img.SaveToFile('buttons.png');
    img.Free;
  end;
      

See Also

TButtonOption, TButtonOptions, TLayeredImage32.GetMergedImage