Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TMS FNC UI Pack
TTMSFNCListBox: Rating

procedure TForm3.FormCreate(Sender: TObject);
var
  I: Integer;
begin
  for I := 0 to TMSFNCListBox1.Items.Count - 1 do
    TMSFNCListBox1.Items[I].DataInteger := RandomRange(1, 6)
end;

procedure TForm3.TMSFNCListBox1AfterDrawItem(Sender: TObject;
  AGraphics: TTMSFNCGraphics; ARect: TRectF; AItem: TTMSFNCListBoxItem);
var
  r: Integer;
  I: Integer;
  bmp: TBitmap;
  rrt: TRectF;
begin
  r := AItem.DataInteger;
  bmp := TMSFNCBitmapContainer1.FindBitmap(''rating'');
  for I := 0 to r - 1 do
  begin
    rrt := RectF(Round(ARect.Right - ((bmp.Width + 4) * (I + 1))), Round(ARect.Top + (ARect.Height - bmp.Height) / 2),
      Round(ARect.Right - ((bmp.Width + 4) * I)), Round(ARect.Top + (ARect.Height - bmp.Height) / 2 + bmp.Height));

    AGraphics.DrawBitmap(rrt, bmp);
  end;
end;