Welcome Guest [Log In] [Register]
Welcome to Scisforums. We hope you enjoy your visit.


You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
[Release]C# Activity2 "About Dialog Box"; Fade effect
Topic Started: Jun 30 2010, 08:20 PM (962 Views)
malufett
Member Avatar
Pentium 4
[ *  *  *  *  * ]
I'm sure some of you are getting hard to make a fading effect on your Form.
:$

check this chunk of codes:
Code:
 

public class FadingForm : Form
{

private System.Windows.Forms.Timer timer;
private System.ComponentModel.IContainer components;

public About()
{
this.components = new System.ComponentModel.Container();
this.timer = new System.Windows.Forms.Timer(this.components);
this.timer.Tick += new System.EventHandler(this.timer_Tick);
//
// Add your codes here (panels, buttons & etc.)
//
}

private void timer_Tick(object sender, System.EventArgs e)
{
Opacity -= (timer.Interval / 1000.0);
if (this.Opacity > 0)
timer.Enabled = true;
else
{
timer.Enabled = false;
Close();
}
}

protected override void OnClosing(CancelEventArgs e)
{
base.OnClosing(e);

if (e.Cancel == true) return;

if (Opacity > 0)
{
timer.Enabled = true;
e.Cancel = true;
}
}
}


to test:
Code:
 

public void LaunchFadeForm()
{
FadingForm myForm = new FadingForm();
myForm.ShowDialog();
}


Enjoy! ;)
Edited by malufett, Jun 30 2010, 08:30 PM.
Posted Image
Ragnarok 3rd Jobs Development : http://svn6.assembla.com/svn/ReAM_
Accepting Paid Services
Limit Ragnarok Online(LimitRO)


The Quality Maker
powered by: rudolp
Offline Profile Quote Post Goto Top
 
insolence
Member Avatar
Dual Core
[ *  *  *  *  *  *  * ]
malufett
Jun 30 2010, 08:20 PM
I'm sure some of you are getting hard to make a fading effect on your Form.
:$

check this chunk of codes:
Code:
 

public class FadingForm : Form
{

private System.Windows.Forms.Timer timer;
private System.ComponentModel.IContainer components;

public About()
{
this.components = new System.ComponentModel.Container();
this.timer = new System.Windows.Forms.Timer(this.components);
this.timer.Tick += new System.EventHandler(this.timer_Tick);
//
// Add your codes here (panels, buttons & etc.)
//
}

private void timer_Tick(object sender, System.EventArgs e)
{
Opacity -= (timer.Interval / 1000.0);
if (this.Opacity > 0)
timer.Enabled = true;
else
{
timer.Enabled = false;
Close();
}
}

protected override void OnClosing(CancelEventArgs e)
{
base.OnClosing(e);

if (e.Cancel == true) return;

if (Opacity > 0)
{
timer.Enabled = true;
e.Cancel = true;
}
}
}


to test:
Code:
 

public void LaunchFadeForm()
{
FadingForm myForm = new FadingForm();
myForm.ShowDialog();
}


Enjoy! ;)
halakata baka makita to ni sir...

tip lng... about ung rounded edges may mga pre-generated code snippet sa microsoft community forum... just study the code and experiment on it to get familiarized with it's function...

and maybe its more convenient to use the timer.start() and .stop()


hmmm i like your algo algo... dynamicaly generated ung timer... Galing... ako asa lang sa IDE hehe
I Played RF online and Became on of the TOP players
Then I got banned permanently cause of the DDM SK bug
I Played RF Olympic and Owned the Highlevels
Then I got banned for Camping Once
Yet the CW urge is still coming back to me
Offline Profile Quote Post Goto Top
 
malufett
Member Avatar
Pentium 4
[ *  *  *  *  * ]
aw hindi nga.. :blink:


hehe..tinatamad din kasi ako magtititingin ng forum..lalo na over hundreds yung thread..haha

Posted Image
Ragnarok 3rd Jobs Development : http://svn6.assembla.com/svn/ReAM_
Accepting Paid Services
Limit Ragnarok Online(LimitRO)


The Quality Maker
powered by: rudolp
Offline Profile Quote Post Goto Top
 
insolence
Member Avatar
Dual Core
[ *  *  *  *  *  *  * ]
malufett
Jun 30 2010, 08:49 PM
aw hindi nga.. :blink:


hehe..tinatamad din kasi ako magtititingin ng forum..lalo na over hundreds yung thread..haha

hehe samesame lng naman.. piliin mo ung di xa gagamit nung drawing.2d blahblah... ung may roundedrectangle() ata na method un hehe... di ko kasi maintindihan ung pag add ng 2d shapes sa region eh haha... tas tamad pa ako... kaya kinalkal ko nlng ung MS community forum hehe tas nakalagay nmn dun for public use... XD
I Played RF online and Became on of the TOP players
Then I got banned permanently cause of the DDM SK bug
I Played RF Olympic and Owned the Highlevels
Then I got banned for Camping Once
Yet the CW urge is still coming back to me
Offline Profile Quote Post Goto Top
 
mynameismorrie
Member Avatar
Pentium 2
[ *  * ]
gusto nyo ng sikret?? gumamit ka na lang ng button na walang text tas white backcolor na naka disable. OHA OHA. :]
Posted Image
TEGAN RAIN QUIN is my happiness. :]
Offline Profile Quote Post Goto Top
 
malufett
Member Avatar
Pentium 4
[ *  *  *  *  * ]
mynameismorrie
Jul 2 2010, 09:13 PM
gusto nyo ng sikret?? gumamit ka na lang ng button na walang text tas white backcolor na naka disable. OHA OHA. :]
Secret? para saan?
Posted Image
Ragnarok 3rd Jobs Development : http://svn6.assembla.com/svn/ReAM_
Accepting Paid Services
Limit Ragnarok Online(LimitRO)


The Quality Maker
powered by: rudolp
Offline Profile Quote Post Goto Top
 
mynameismorrie
Member Avatar
Pentium 2
[ *  * ]
malufett
Jul 2 2010, 09:47 PM
mynameismorrie
Jul 2 2010, 09:13 PM
gusto nyo ng sikret?? gumamit ka na lang ng button na walang text tas white backcolor na naka disable. OHA OHA. :]
Secret? para saan?
yung rounded rectangle. hahaha. gumamit lang ako ng button na walang text tsaka disabled. hahaha. patulong nga po sa timer.. please?
Posted Image
TEGAN RAIN QUIN is my happiness. :]
Offline Profile Quote Post Goto Top
 
malufett
Member Avatar
Pentium 4
[ *  *  *  *  * ]
mynameismorrie
Jul 2 2010, 09:50 PM
malufett
Jul 2 2010, 09:47 PM
mynameismorrie
Jul 2 2010, 09:13 PM
gusto nyo ng sikret?? gumamit ka na lang ng button na walang text tas white backcolor na naka disable. OHA OHA. :]
Secret? para saan?
yung rounded rectangle. hahaha. gumamit lang ako ng button na walang text tsaka disabled. hahaha. patulong nga po sa timer.. please?
haha..yun lang pala..ako gumamit na lang ako ng image para my gradient..hehe..
timer? anung gusto mo malaman sa timer?
Posted Image
Ragnarok 3rd Jobs Development : http://svn6.assembla.com/svn/ReAM_
Accepting Paid Services
Limit Ragnarok Online(LimitRO)


The Quality Maker
powered by: rudolp
Offline Profile Quote Post Goto Top
 
mynameismorrie
Member Avatar
Pentium 2
[ *  * ]
ung kung pano ilagay un sa about box.. tapos kung pano nag 5 4 3 2 1 ung kay sir.. hehehe. 5 4 3 lang kasi ung lumalabas sakin.. tas di pa nagcoclose..
Posted Image
TEGAN RAIN QUIN is my happiness. :]
Offline Profile Quote Post Goto Top
 
insolence
Member Avatar
Dual Core
[ *  *  *  *  *  *  * ]
mynameismorrie
Jul 2 2010, 10:29 PM
ung kung pano ilagay un sa about box.. tapos kung pano nag 5 4 3 2 1 ung kay sir.. hehehe. 5 4 3 lang kasi ung lumalabas sakin.. tas di pa nagcoclose..
gawa ka ng variable outside the methods tas int countdown = 5; tas decrement mo lng xa sa tick nung timer tas display mo ung countdown sa message ^^ parang label1.text = "closign in " + cowntdown + " sec, or click the image" then when the couwntdown hits zero start your fading algo... I used another timer for that

use the Dispose(); mehtod to close the aboutbox ^^
Edited by insolence, Jul 2 2010, 10:37 PM.
I Played RF online and Became on of the TOP players
Then I got banned permanently cause of the DDM SK bug
I Played RF Olympic and Owned the Highlevels
Then I got banned for Camping Once
Yet the CW urge is still coming back to me
Offline Profile Quote Post Goto Top
 
mynameismorrie
Member Avatar
Pentium 2
[ *  * ]
insolence
Jul 2 2010, 10:36 PM
gawa ka ng variable outside the methods tas int countdown = 5; tas decrement mo lng xa sa tick nung timer tas display mo ung countdown sa message ^^ parang label1.text = "closign in " + cowntdown + " sec, or click the image" then when the couwntdown hits zero start your fading algo... I used another timer for that

use the Dispose(); mehtod to close the aboutbox ^^
methods ng mismong about box?? haaaa?? err..

parang..

int countdown = 5;

timer_tick[blabla]{

countdown--;

if [countdown == 0] {
timer.stop;
}

}

ganyan??
nga pala... san mo isastart ung timer?? sa loob ng about box o sa kabilang form?? anhiraaaapp.. un na lang kulang ko, ang hirap pa. ahahaha.
Edited by mynameismorrie, Jul 2 2010, 10:43 PM.
Posted Image
TEGAN RAIN QUIN is my happiness. :]
Offline Profile Quote Post Goto Top
 
malufett
Member Avatar
Pentium 4
[ *  *  *  *  * ]
mynameismorrie
Jul 2 2010, 10:41 PM
insolence
Jul 2 2010, 10:36 PM
gawa ka ng variable outside the methods tas int countdown = 5; tas decrement mo lng xa sa tick nung timer tas display mo ung countdown sa message ^^ parang label1.text = "closign in " + cowntdown + " sec, or click the image" then when the couwntdown hits zero start your fading algo... I used another timer for that

use the Dispose(); mehtod to close the aboutbox ^^
methods ng mismong about box?? haaaa?? err..

parang..

int countdown = 5;

timer_tick[blabla]{

countdown--;

if [countdown == 0] {
timer.stop;
}

}

ganyan??
nga pala... san mo isastart ung timer?? sa loob ng about box o sa kabilang form?? anhiraaaapp.. un na lang kulang ko, ang hirap pa. ahahaha.
i override mo yung OnLoad() dun mo ilagay yung pagstart nung timer..kasi pag sinabay mo sa pagload ng forms di siya magpapakita..
para sa aking mas maganda gaiting yung Close() kaysa Dispose() lalo na pag hindi mo ilalagay sa main form..kasi pag clinose open mo yung form magkakaron ka ng problema..^^
Posted Image
Ragnarok 3rd Jobs Development : http://svn6.assembla.com/svn/ReAM_
Accepting Paid Services
Limit Ragnarok Online(LimitRO)


The Quality Maker
powered by: rudolp
Offline Profile Quote Post Goto Top
 
insolence
Member Avatar
Dual Core
[ *  *  *  *  *  *  * ]
kahit di na

start mo lng ung timer mo after InitializeComponent na method sa class declaration

public AboutBox(){
InitializeComponent();
timer1.start();
}

tas if countdown = 0

timer.stop();
Dispose();

or fade then dispose
Edited by insolence, Jul 2 2010, 10:52 PM.
I Played RF online and Became on of the TOP players
Then I got banned permanently cause of the DDM SK bug
I Played RF Olympic and Owned the Highlevels
Then I got banned for Camping Once
Yet the CW urge is still coming back to me
Offline Profile Quote Post Goto Top
 
malufett
Member Avatar
Pentium 4
[ *  *  *  *  * ]
oo puede rin..basta alam mo lang kung saan isisingit ok ka na..
Posted Image
Ragnarok 3rd Jobs Development : http://svn6.assembla.com/svn/ReAM_
Accepting Paid Services
Limit Ragnarok Online(LimitRO)


The Quality Maker
powered by: rudolp
Offline Profile Quote Post Goto Top
 
insolence
Member Avatar
Dual Core
[ *  *  *  *  *  *  * ]
di mo nmn ioopen close eh kasi showdialog ang gagamitin kaya di mo maaccess ung form1 para open ulit ung aboutbox ng 2x + walang public static variables sa about box kaya wala ung error na magkakaconclift sa values ng mga var mo
malufett
Jul 2 2010, 10:54 PM
oo puede rin..basta alam mo lang kung saan isisingit ok ka na..
tama ka kaya pag magdedeclare kau nga mga properties dun after initcomp method nio gawin kasi sabi mo nga hindi magpapakita
Edited by insolence, Jul 2 2010, 10:56 PM.
I Played RF online and Became on of the TOP players
Then I got banned permanently cause of the DDM SK bug
I Played RF Olympic and Owned the Highlevels
Then I got banned for Camping Once
Yet the CW urge is still coming back to me
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
ZetaBoards - Free Forum Hosting
Free Forums. Reliable service with over 8 years of experience.
Go to Next Page
« Previous Topic · Programming · Next Topic »
Add Reply


Latest posts is now loading...Please wait...
Free Domain Name Service