Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Fade In/Fade out Function?(Delphi)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Never Again
I post too much
Reputation: 0

Joined: 13 Jan 2007
Posts: 2000
Location: New Mexico

PostPosted: Sat Nov 10, 2007 6:32 pm    Post subject: Fade In/Fade out Function?(Delphi) Reply with quote

How would I be able to do a Fade in and Fade out function for a project. I've seen it done many times, I've asked SCRN how he does it but he hasn't sent a reply. I would appreciate if someone can teach me how to do it in Delphi.
Back to top
View user's profile Send private message MSN Messenger
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sat Nov 10, 2007 7:41 pm    Post subject: Reply with quote

http://delphi.about.com/od/formsdialogs/a/fadeinmodalform.htm
http://planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=1189&lngWId=7

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Sat Nov 10, 2007 7:47 pm    Post subject: Reply with quote

Code:


procedure/function/whatever...
:
var
:
i : integer;
:
begin
:
:
//Fade in
for i := 0 to 100 do
MyForm.Opacity := i; //I think that's how you do it--not quite sure about the Form.Opacity: it's how you'd do it in C#
:
:
//Fade out
for i:= 100 to 0 do
MyForm.Opacity := i;
:
:
end
Back to top
View user's profile Send private message
Never Again
I post too much
Reputation: 0

Joined: 13 Jan 2007
Posts: 2000
Location: New Mexico

PostPosted: Sat Nov 10, 2007 8:07 pm    Post subject: Reply with quote

I already got I just need to know how to make it fade out when you close the form.
Back to top
View user's profile Send private message MSN Messenger
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Sat Nov 10, 2007 8:35 pm    Post subject: Reply with quote

Destructor
Back to top
View user's profile Send private message
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Sun Nov 11, 2007 12:44 am    Post subject: Reply with quote

samuri25404 wrote:
Code:

//Fade out
for i:= 100 to 0 do
MyForm.Opacity := i;

It will not work in delphi. In delphi u need to do it like this
Code:
for i:= 100 Down to 0 do
MyForm.Opacity := i;

ehe is my code:
Code:
  repeat
  //In
    AlphaBlendValue:=AlphaBlendValue+1;
  until AlphaBlendValue = 255;
  //Out
  repeat
    AlphaBlendValue:=AlphaBlendValue-1;
  until AlphaBlendValue = 0;

make sure that "AlphaBlend" in Object Inspector is "True".
Back to top
View user's profile Send private message
Never Again
I post too much
Reputation: 0

Joined: 13 Jan 2007
Posts: 2000
Location: New Mexico

PostPosted: Sun Nov 11, 2007 1:17 am    Post subject: Reply with quote

Nevermind, thanks anyways I found it out already.
Code:
--------

Fade in:
Code:
--------

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  if Form1.AlphaBlendValue >= 255 then
    begin
      Timer1.Enabled := false;
    end
  else
    begin
      Form1.AlphaBlendValue := Form1.AlphaBlendValue + 5;
    end;
end; 

---------

Fade out:
Code:
---------

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  if Form1.AlphaBlendValue <= 0 then
    begin
      Timer1.Enabled := false;
    end
  else
    begin
      Form1.AlphaBlendValue := Form1.AlphaBlendValue - 5;
    end;
end; 
Back to top
View user's profile Send private message MSN Messenger
Uzeil
Moderator
Reputation: 6

Joined: 21 Oct 2006
Posts: 2411

PostPosted: Sun Nov 11, 2007 2:29 am    Post subject: Reply with quote

Or writen with the assumption that you want it to fade in when opening the application, and out when closing:

(Poorly coded, I didn't feel like finding a better event to code it in, so I just had another thread do it.)

Code:
type mythread = class(TThread)
public
  procedure execute; override;
end;
Code:
procedure TForm1.FormShow(Sender: TObject);
begin
  alphablendvalue:=0;
  mythread.Create(false);
end;

procedure mythread.execute;
var i: integer;
begin
  for i:=0 to 255 do
    Form1.AlphaBlendValue:=i;
  terminate;
end;

procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
var i: integer;
begin
  for i:=255 downto 0 do
    Form1.AlphaBlendValue:=i;
end;


Although personally, I don't like fading out... I like my programs to close immediately upon hitting the big [X].

_________________


Mini Engine v3.0
Mipla v1.0

Reposted old threads out of the MS section.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites