Fast Report dynamicznie

0

Witam
Mam raport zrobiony w fastreport ver 2.
Wyswietlam go w podgladzie wydruku tez z palety fr.
Na raportcie mam kilka obiektow memo.
Chcialbym zeby po kliknieciu na dane memo na podgladzie wydruku
styl czcionki zmienil sie na przekreslony.
Jak to zrobic?

0

Na razie udało mi sie coś takiego wypracować.
Jak by ktoś znalazł lepszy sposób (np bez przeładowania raportu) to niech pisze!

type
  TForm1 = class(TForm)
    Button1: TButton;
    frReport1: TfrReport;
    frPreview1: TfrPreview;
    procedure Button1Click(Sender: TObject);
    procedure frReport1ObjectClick(View: TfrView);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  u1,u2,u3 : boolean;
implementation

{$R *.dfm}



procedure TForm1.Button1Click(Sender: TObject);
begin
frReport1.LoadFromFile('c:\testr.frf');
u1:=false;
u2:=false;
u3:=false;
frReport1.ShowReport;
end;

procedure TForm1.frReport1ObjectClick(View: TfrView);
var
  Memo : TfrMemoView;
  go   : boolean;
begin
  go:=false;
  if (View.Name='Memo1') then begin
    u1:=not u1;
    go:=true;
  end;
  if (View.Name='Memo2')then begin
    u2:=not u2;
    go:=true;
  end;
  if (View.Name='Memo3') then begin
    u3:=not u3;
    go:=true;
  end;
  if go then begin
    frReport1.LoadFromFile('c:\testr.frf');
    Memo:=frReport1.FindObject('Memo1') as TfrMemoView;
    if u1 then
      Memo.Font.Style:=Memo.Font.Style+[fsStrikeOut]
    else
      Memo.Font.Style:=Memo.Font.Style-[fsStrikeOut];

    Memo:=frReport1.FindObject('Memo2') as TfrMemoView;
    if u2 then
      Memo.Font.Style:=Memo.Font.Style+[fsStrikeOut]
    else
      Memo.Font.Style:=Memo.Font.Style-[fsStrikeOut];

    Memo:=frReport1.FindObject('Memo3') as TfrMemoView;
    if u3 then
      Memo.Font.Style:=Memo.Font.Style+[fsStrikeOut]
    else
      Memo.Font.Style:=Memo.Font.Style-[fsStrikeOut];

    frReport1.ShowReport;
  end;
end;

1 użytkowników online, w tym zalogowanych: 0, gości: 1