使用AnimateWindow API函数后,构件显示不正常,如何解决?(20分)

  • 主题发起人 主题发起人 monkey999
  • 开始时间 开始时间
M

monkey999

Unregistered / Unconfirmed
GUEST, unregistred user!
我在窗体中使用API函数,<br>AnimateWindowAnimateWindow(Self.Handle, 250, AW_BLEND or AW_ACTIVATE); <br>它使Windows图形界面实现了卷帘、淡入淡出和弹出效果。但一些控件显示正常,其他的<br>控件绘图有错误,还有一些根本不显示!书上说,窗体中的控件的windows程序必须处理<br>WM_PRINT或WM_PRINTCLIENT消息,使它们与AnimateWindow API函数一起使用。<br>以GroupBox为例,要加下面的代码。<br>unit TestGroupBox; <br><br>interface <br><br>uses <br>&nbsp; Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, <br>&nbsp; StdCtrls; <br><br>type <br>&nbsp; TTestGroupBox = class(TGroupBox) <br>&nbsp; private <br>&nbsp; &nbsp; { Private declarations } <br>&nbsp; protected <br>&nbsp; &nbsp; { Protected declarations } <br>&nbsp; &nbsp; procedure WMPrintClient(var Msg: TMessage); message WM_PRINTCLIENT; <br><br>&nbsp; public <br>&nbsp; &nbsp; { Public declarations } <br>&nbsp; published <br>&nbsp; &nbsp; { Published declarations } <br>&nbsp; end; <br><br>procedure Register; <br><br>implementation <br><br>procedure Register; <br>begin <br>&nbsp; RegisterComponents(''Test'', [TTestGroupBox]); <br>end; <br>procedure TTestGroupBox.WMPrintClient(var Msg: TMessage); <br>begin <br>&nbsp; &nbsp; &nbsp;PaintTo(HDC(Msg.WParam), 0, 0); <br>end; <br>end. <br>可是,无效!为什么? &nbsp;我在主程序中的加了uses TestGroupBox;也还是不行。<br>怎么办?
 
procedure TForm1.FormShow(Sender: TObject);<br>var<br>&nbsp; i:integer;<br>begin<br>&nbsp; AnimateWindow(HandLe,80,AW_CENTER);<br>&nbsp; for i:=0 to ControlCount-1 do<br>&nbsp; &nbsp; Controls.Refresh;<br>&nbsp; Form1.BringToFront;<br>end;
 
后退
顶部