当前位置:主页>仓库管理软件> 列表

窗体闪烁,高分请教! 找出纳记账软件

仓库管理软件版1楼: 问题:
做一个ActiveForm窗体到ocx中,然后应用程序中调用ocx中的activeform,加载速度慢,其实初始化很简单,这是一个问题,另外一个,如在ActiveForm中弹出一个对话框,关闭后整个背景窗体都闪烁,这是第二个问题,请高手赐教,分没有问题!
环境:Windows2003 Ent + Delphi7 + MSDE

2楼: 用LockWindowUpdate(Handle)锁定屏幕自动刷新;
用LockWindowUpdate(0)释放屏幕自动刷新。 如零售管理

3楼: 嘿...这么漂亮的效果啥弄的...我上次还用时间控件写了好一串代码才实现.

4楼: 代码帖出来看看

5楼: 问题补充:
ActiveForm显示在OleContainer中,组件位置层次:
TForm
--TPanel
--TOleContainer

6楼: LockWindowUpdate(self.Handle);
try
//OKRightDlg 窗体用来显示OCX中的ActiveForm
OKRightDlg := TOKRightDlg.Create( nil);
OKRightDlg.width := pwidth ;
OKRightDlg.Height := pheight ;
OKRightDlg.Position := poScreenCenter;
OKRightDlg.Caption:= thecap;
OKRightDlg.ShowModal;


finally
LockWindowUpdate(0);
end;

仓库管理软件版7楼: 用LockWindowUpdate(Handle)锁定屏幕自动刷新;
用LockWindowUpdate(0)释放屏幕自动刷新。

仍解决不了问题! 使用方法应该没有问题吧?

8楼: 对话框说什么了呢

9楼: 去掉
LockWindowUpdate(0);呢

10楼: 对话框就是:Application.MessageBox()

11楼: 最强硬的办法:截获Window消息,如下:
...
type
TForm1 = class(TForm)
...
public
procedure WMPaint(var Message: TWMPaint); message WM_PAINT;
...
end;

var
Form1: TForm1;

implementation

{$R *.dfm}
procedure TForm1.WMPaint(var Message: TWMPaint);
begin
if 应当刷新标志变量 then
inherited;
end;
...

12楼: 谢谢大家的关心和帮助,问题仍没有解决,请还没回家过年的高手速来报到,将有厚礼等待! 如出纳记账软件

13楼: 不可能啊!?我的方法肯定可以的啊!
你把:
LockWindowUpdate(self.Handle);
try
//OKRightDlg 窗体用来显示OCX中的ActiveForm
OKRightDlg := TOKRightDlg.Create( nil);
OKRightDlg.width := pwidth ;
OKRightDlg.Height := pheight ;
OKRightDlg.Position := poScreenCenter;
OKRightDlg.Caption:= thecap;
OKRightDlg.ShowModal;
finally
LockWindowUpdate(0);
end;
改为:
blUpdateFlag := False;
try
//OKRightDlg 窗体用来显示OCX中的ActiveForm
OKRightDlg := TOKRightDlg.Create( nil);
OKRightDlg.width := pwidth ;
OKRightDlg.Height := pheight ;
OKRightDlg.Position := poScreenCenter;
OKRightDlg.Caption:= thecap;
OKRightDlg.ShowModal;
finally
blUpdateFlag := True;
end;
然后调用我写的刷新窗口消息过程,如下:
...
procedure TForm1.WMPaint(var Message: TWMPaint);
begin
if blUpdateFlag then
inherited;
end;
...
其中,blUpdateFlag为窗口刷新标志变量(Boolean型)。当需要刷新窗口时置True,否则置False既可。