Table of Contents

Fill Kind Selection

TTMSFNCFillKindPicker uses TTMSFNCFillKindSelector to show available TTMSFNCGraphicsFillKind values in a compact picker.

Fill kind selector items

Configure the Picker

Set SelectedFillKind to choose the initial value. Use CloseOnSelection, DropDownWidth, and DropDownHeight to control the drop-down behavior.

TMSFNCFillKindPicker1.SelectedFillKind := gfkSolid;
TMSFNCFillKindPicker1.CloseOnSelection := True;
TMSFNCFillKindPicker1.DropDownWidth := 160;
TMSFNCFillKindPicker1.DropDownHeight := 140;
TMSFNCFillKindPicker1.OnFillKindSelected := TMSFNCFillKindPicker1FillKindSelected;

Apply Selection

Handle OnFillKindSelected to apply the selected fill kind to another fill object or to persist the choice.

procedure TForm1.TMSFNCFillKindPicker1FillKindSelected(Sender: TObject; AFillKind: TTMSFNCGraphicsFillKind);
begin
  TMSFNCPanel1.Fill.Kind := AFillKind;
end;

Use the Selector Directly

Use TTMSFNCFillKindSelector directly when users should see the fill-kind choices without opening a drop-down.

Fill kind selector on a form
TMSFNCFillKindSelector1.SelectedFillKind := gfkGradient;
TMSFNCFillKindSelector1.OnFillKindSelected := TMSFNCFillKindPicker1FillKindSelected;

Combining the picker, selection handling, and the visible selector

Keep a picker and a standalone selector in sync so a toolbar button and a settings panel always show the same fill kind:

procedure TForm1.FormCreate(Sender: TObject);
begin
  TTMSFNCFillKindPicker1.SelectedFillKind   := gfkSolid;
  TTMSFNCFillKindPicker1.CloseOnSelection   := True;
  TTMSFNCFillKindSelector1.SelectedFillKind := gfkSolid;
end;

procedure TForm1.TTMSFNCFillKindPicker1FillKindSelected(
  Sender: TObject; AFillKind: TTMSFNCGraphicsFillKind);
begin
  TTMSFNCFillKindSelector1.SelectedFillKind := AFillKind;
  MyShape.Fill.Kind := AFillKind;
end;

See Also