相信许多人都想实现这个功能,拜托各位看一下这段代码为什么不行?(about fastreport) (100分)

  • 主题发起人 主题发起人 geng7758
  • 开始时间 开始时间
G

geng7758

Unregistered / Unconfirmed
GUEST, unregistred user!
在frReport的OnObjectClick事件中加入以下代码,目的是点一下鼠标,使点中的frMemoView背景变成红色,
procedure TFormOptions.frReportObjectClick(View: TfrView);
begin
if (View is TfrMemoView) then
begin
with TfrMemoView(frView)do
begin
FillColor := clRed;
end;
end;
end;

但是实际点击后不会自动刷新,必须切换一下窗口才可以看出红色效果,而且拖到下一页,一刷新后又没了,
请问各位可有好招?有急用!分不够可加!
 
只能手动刷新了
 
to dh12001:
兄弟,手动要怎么刷?
 
to caidao:
兄弟,我试了不行啊,能否来个完整的?
 
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, RM_class, StdCtrls, RM_PrvDlg, ExtCtrls, RM_view;
type
TForm1 = class(TForm)
RMReport1: TRMReport;
Button1: TButton;
RMPreview1: TRMPreview;
procedure RMReport1ObjectClick(EMFPages: TRMEMFPages;
aPageNo: Integer;
View: TRMView);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.RMReport1ObjectClick(EMFPages: TRMEMFPages;
aPageNo: Integer;
View: TRMView);
var
i: integer;
begin

if (View is TrmMemoView) then
begin
with TrmMemoView(View)do
begin
FillColor := clRed;
// screen.ActiveForm.Refresh;
with screen.ActiveFormdo
begin

for i := 0 to ComponentCount - 1do
if Components is twincontrol then
if sametext('TRMPreview',twincontrol(Components).ClassName) then
begin
TRMPreview(Components).top:=1;
// TRMPreview(Components).OnResize(TRMPreview(Components));
end;
end;
end;
end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
RMReport1.ShowReport;
end;

end.

 
to hfghfghfg:
Thanks!会给您加分的。
虽然会抖动,不过是可以刷新了,还有能否一并解决一下:
'翻到下一页,再翻上去一看又没了'这个问题?
 
改控件源码
 
to hfghfghfg:
给点思路怎么改?对了我用的是FastReport
 
后退
顶部