anchor.diff:      FFont: TfpgFont;
       FBoxLayout: TBoxLayout;
       FBoxSize: integer;
  +    FImgTextSpacing: integer;
       FIsPressed: boolean;
       function    GetBoxLayout: TBoxLayout;
       function    GetFontDesc: string;
  
positive.code: procedure TfpgBaseCheckBox.HandlePaint;
  var
    r: TfpgRect;
    ty: integer;
    tx: integer;
    ix: integer;
    img: TfpgImage;
    cliprect: TfpgRect;
  begin
    inherited HandlePaint;
    
    Canvas.SetColor(FBackgroundColor);
    Canvas.FillRectangle(0, 0, Width, Height);
    Canvas.SetFont(Font);
    cliprect.SetRect(1, 1, Width-2, Height-2);
  
    if FFocused then
    begin
      Canvas.SetColor(clText1);
      Canvas.SetLineStyle(1, lsDot);
      Canvas.DrawRectangle(cliprect);
      InflateRect(cliprect, 1, 1);
    end;
    Canvas.SetClipRect(cliprect);
    Canvas.SetLineStyle(1, lsSolid);
  
    if FBoxLayout = tbLeftBox then
      r.SetRect(2, (Height div 2) - (FBoxSize div 2), FBoxSize, FBoxSize)
    else
      r.SetRect(Width - FBoxSize - 2, (Height div 2) - (FBoxSize div 2), FBoxSize, FBoxSize);
    if r.top < 0 then
      r.top := 0;
  
  
negative.code:   else
      ix := (2 + (Ord(FChecked) * 2)) - Ord(FChecked);
  
    // paint the check (in this case a X)
    img := fpgImages.GetImage('sys.checkboxes');    // Do NOT localize
    Canvas.DrawImagePart(r.Left, r.Top, img, ix*FBoxSize, 0, FBoxSize, FBoxSize);
  
    r := GetClientRect;
    { max focus rectangle and text boundry }
    InflateRect(r, -1, -1);
    { exclude the checkbox image and spacing from rectangle }
    if FBoxLayout = tbLeftBox then
    begin
      r.Left  := r.Left + FBoxSize + FImgTextSpacing;
      r.Width := r.Width - FBoxSize - FImgTextSpacing;
    end
    else
      r.Width := r.Width - FBoxSize - FImgTextSpacing;
  
    Canvas.SetTextColor(FTextColor);
    Canvas.SetClipRect(r);
  
    if Enabled then
      LFlags := [txtLeft, txtVCenter]
    else
      LFlags := [txtLeft, txtVCenter, txtDisabled];
    Canvas.DrawText(r, FText, LFlags);   { internally this still calls fpgStyle.DrawString(), so theming will be applied }
  
    if FFocused then
    begin
      Canvas.ClearClipRect;
      { adjust focusrect-to-text margin }
      if FBoxLayout = tbLeftBox then
      begin
        r.Left := r.Left - 2;
        r.Width := r.Width + 2;
      end
      else
      begin
        r.Width := r.Width + 2;
      end;
      { undo the 2px focusrect-to-text margin, so we simply use the clip rect }
      fpgStyle.DrawFocusRect(Canvas, r);
    end;
  end;
  
  procedure TfpgBaseCheckBox.HandleLMouseDown(x, y: integer; shiftstate: TShiftState);
  