FontStrikethru(Labelなど)


FontStrikethruプロパティは文字に取り消し線を設定します。Delphiでは TFontクラスの「Style」プロパティで設定しますが, このプロパティは集合型です。太字は Styleプロパティに fsStrikeoutを追加します。解除する場合は fsStrikeoutを取り除きます。

■ TLabelに取り消し線を設定する例
  procedure TForm1.Button1Click(Sender: TObject);
  begin
    {スタイルに取り消し線が指定されているか?}
    if  fsStrikeout  in  Label1.Font.Style then  begin
      {スタイルから取り消し線だけを解除する}
      Label1.Font.Style :=  Label1.Font.Style - [fsStrikeout];
    end else begin
      {スタイルに取り消し線を設定する}
      Label1.Font.Style :=  Label1.Font.Style + [fsStrikeout];
    end;
  end;