View previous topic :: View next topic |
Author |
Message |
Pepsiguy I post too much
Reputation: 0
Joined: 16 Aug 2007 Posts: 2016
|
Posted: Mon Dec 03, 2007 2:50 pm Post subject: [visualBasic6]Fading Effect codes? |
|
|
i know u can do it with timers and opacity but how?
_________________
|
|
Back to top |
|
 |
Blader I post too much
Reputation: 2
Joined: 19 Jan 2007 Posts: 2049
|
Posted: Mon Dec 03, 2007 3:31 pm Post subject: |
|
|
You can use this code, although it's a little slow
You just need a timer =)
Code: | Dim Alpha
Const LWA_COLORKEY = &H1
Const LWA_ALPHA = &H2
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80000
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Sub Form_Load()
Dim Ret As Long
Ret = GetWindowLong(Me.hWnd, GWL_EXSTYLE)
Ret = Ret Or WS_EX_LAYERED
SetWindowLong Me.hWnd, GWL_EXSTYLE, Ret
Timer1.Interval = 20
End Sub
Private Sub Timer1_Timer()
Alpha = Alpha + 1
If Alpha > 255 Then
Timer1.Enabled = False
Exit Sub
End If
SetLayeredWindowAttributes Me.hWnd, 0, Alpha, LWA_ALPHA
End Sub |
_________________
|
|
Back to top |
|
 |
Pepsiguy I post too much
Reputation: 0
Joined: 16 Aug 2007 Posts: 2016
|
Posted: Mon Dec 03, 2007 3:45 pm Post subject: |
|
|
um.....i need a quick code like there was this thingy that you could set it to like 100 and 200 and etc
_________________
|
|
Back to top |
|
 |
Blader I post too much
Reputation: 2
Joined: 19 Jan 2007 Posts: 2049
|
Posted: Mon Dec 03, 2007 4:24 pm Post subject: |
|
|
Umm I don't think there is...
It isin't that simple
_________________
|
|
Back to top |
|
 |
Devilizer Master Cheater
Reputation: 0
Joined: 22 Jun 2007 Posts: 451
|
Posted: Mon Dec 03, 2007 6:35 pm Post subject: |
|
|
Edit: Bleh, found out.
Code: | Dim Alpha
Const LWA_COLORKEY = &H1
Const LWA_ALPHA = &H2
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80000
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Sub Form_Load()
Dim Ret As Long
Ret = GetWindowLong(Me.hWnd, GWL_EXSTYLE)
Ret = Ret Or WS_EX_LAYERED
SetWindowLong Me.hWnd, GWL_EXSTYLE, Ret
Timer1.Interval = 20
End Sub
Private Sub Timer1_Timer()
Alpha = Alpha + 10
If Alpha > 255 Then
Timer1.Enabled = False
Exit Sub
End If
SetLayeredWindowAttributes Me.hWnd, 0, Alpha, LWA_ALPHA
End Sub
|
Use this.
|
|
Back to top |
|
 |
Blader I post too much
Reputation: 2
Joined: 19 Jan 2007 Posts: 2049
|
Posted: Mon Dec 03, 2007 6:47 pm Post subject: |
|
|
Lulz that's the same as mine o.o
_________________
|
|
Back to top |
|
 |
Devilizer Master Cheater
Reputation: 0
Joined: 22 Jun 2007 Posts: 451
|
Posted: Mon Dec 03, 2007 6:53 pm Post subject: |
|
|
Blader wrote: | Lulz that's the same as mine o.o |
Yeah i just played around with it and edited it to fade faster, i think 2 or 3 seconds.
Edit: Sorry, forget to credit ya -_-.
|
|
Back to top |
|
 |
Blader I post too much
Reputation: 2
Joined: 19 Jan 2007 Posts: 2049
|
Posted: Mon Dec 03, 2007 7:09 pm Post subject: |
|
|
Well it wasn't really mine, I copy and pasted stuff from the internet lol
All you changed is the alpha increase I think, that's what I did too, except I did +5 XD
_________________
|
|
Back to top |
|
 |
Never Again I post too much
Reputation: 0
Joined: 13 Jan 2007 Posts: 2000 Location: New Mexico
|
Posted: Mon Dec 03, 2007 8:28 pm Post subject: |
|
|
That's a big code Delphi's is much shorter :
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 is the same, but reversed.
|
|
Back to top |
|
 |
Pepsiguy I post too much
Reputation: 0
Joined: 16 Aug 2007 Posts: 2016
|
Posted: Mon Dec 03, 2007 9:19 pm Post subject: |
|
|
i do not give a Fuc* about delphi
_________________
|
|
Back to top |
|
 |
|