怎样实现类似金山毒霸的动画效果的界面?

canyan 2000-03-01 03:12:00
金山毒霸中,按动右上角的按钮,Tpanel移近移出的动画效果是怎样实现?
仅仅是改变Tpanel的Left等属性会导致严重的闪烁,水能告诉我怎么做?
谢过了!!!
...全文
353 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
pbcl 2001-07-27
  • 打赏
  • 举报
回复
up
dana 2001-07-26
  • 打赏
  • 举报
回复
没想到前面那位比我抢先了一步。
我连Timer也省了:
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls;

type
TForm1 = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
Button1: TButton;
Button2: TButton;
Memo1: TMemo;
ListBox1: TListBox;
RadioGroup1: TRadioGroup;
Memo2: TMemo;
RadioGroup2: TRadioGroup;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
Panel3.Left := Panel1.ClientWidth;
Panel3.Top := 0;
end;

procedure TForm1.Button1Click(Sender: TObject);
var nLoop: Integer;
begin
Panel3.Visible := True;
Panel3.BringToFront;
while Panel3.Left > 0 do
begin
Panel2.Left := Panel2.Left + 4;
Panel3.Left := Panel3.Left - 4;
Application.ProcessMessages;
end;
if Panel3.Left < 0 then Panel3.Left := 0;
Panel2.Visible := False;
Button1.Enabled := False;
Button2.Enabled := True;
end;

procedure TForm1.Button2Click(Sender: TObject);
var nLoop: Integer;
begin
Panel2.Visible := True;
Panel2.BringToFront;
while Panel2.Left > 0 do
begin
Panel3.Left := Panel3.Left + 4;
Panel2.Left := Panel2.Left - 4;
Application.ProcessMessages;
end;
if Panel2.Left < 0 then Panel2.Left := 0;
Panel3.Visible := False;
Button1.Enabled := True;
Button2.Enabled := False;
end;

end.


pbcl 2001-07-26
  • 打赏
  • 举报
回复
up
WuHeHai 2001-05-12
  • 打赏
  • 举报
回复
好古董噢!
Kingron 2001-05-12
  • 打赏
  • 举报
回复
提前。
HF 2000-04-28
  • 打赏
  • 举报
回复
贴一下喽!
Lin 2000-04-28
  • 打赏
  • 举报
回复
我连Timer也省了:
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls;

type
TForm1 = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
Button1: TButton;
Button2: TButton;
Memo1: TMemo;
ListBox1: TListBox;
RadioGroup1: TRadioGroup;
Memo2: TMemo;
RadioGroup2: TRadioGroup;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
Panel3.Left := Panel1.ClientWidth;
Panel3.Top := 0;
end;

procedure TForm1.Button1Click(Sender: TObject);
var nLoop: Integer;
begin
Panel3.Visible := True;
Panel3.BringToFront;
while Panel3.Left > 0 do
begin
Panel2.Left := Panel2.Left + 4;
Panel3.Left := Panel3.Left - 4;
Application.ProcessMessages;
end;
if Panel3.Left < 0 then Panel3.Left := 0;
Panel2.Visible := False;
Button1.Enabled := False;
Button2.Enabled := True;
end;

procedure TForm1.Button2Click(Sender: TObject);
var nLoop: Integer;
begin
Panel2.Visible := True;
Panel2.BringToFront;
while Panel2.Left > 0 do
begin
Panel3.Left := Panel3.Left + 4;
Panel2.Left := Panel2.Left - 4;
Application.ProcessMessages;
end;
if Panel2.Left < 0 then Panel2.Left := 0;
Panel3.Visible := False;
Button1.Enabled := True;
Button2.Enabled := False;
end;

end.
liujh_ty 2000-04-27
  • 打赏
  • 举报
回复
I also wanna known it.
Lin 2000-04-27
  • 打赏
  • 举报
回复
It's so easy: 应该是三个Panel,在其中的一个上放俩,再用两个TThread(用Timer)也行...需要的话,我可以张贴一段Source。
江王 2000-04-23
  • 打赏
  • 举报
回复
参考如下代码:
Panel1.Visible := false;
AnimateWindow( Panel1.Handle, 1000, AW_HOR_POSITIVE );
Panel1.Visible := true; //此句必要,否则下次调用会失败
haiyang 2000-04-23
  • 打赏
  • 举报
回复
用一个TIMER控制两个TPANEL交替重绘。
babyllw 2000-04-22
  • 打赏
  • 举报
回复
好象是用animatewindow这个api,不过我没试出来
不知哪位大侠可以指教一下
superdelphi 2000-03-01
  • 打赏
  • 举报
回复
Just like Netants V1.0
I also wanna known it.
Firing_Sky 2000-03-01
  • 打赏
  • 举报
回复
我觉得那就像是TPanel做的……

604

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 控件与界面
社区管理员
  • 控件与界面社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧