Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Awesome C# Animated Counter
#1
So I created some sort of C# animation, I love big javascript countdown screens,
So I tried re-creating it in C#, Probaly no-one understands what i'm saying right now so check this video
Since i got nowhere to post this i will post it here, altough nobody will try it Tongue



Pretty Cool eh?

If you want to use this in your C# program, you'll have to be a expierenced user
So to use this, create 2 timers, with enabled on true,
one with a interval of 100 and one with 1000
Call them handler1 and handler2
Create 2 panels right under and above and under the place where you want your counters like this:

[Image: t7lQ9.png]
Now create 2 labels with a big font and call them second1 and second2
Ok, you're set to do the coding now
Go to your main entry point (mostly public Form1() or whatever's your formname)
and put this in it
Code:
cache1 = second1.Location;
            cache2 = second2.Location;
Now go to your Form1_Load( void and place the following stuff in it:
Quote:handler2_Tick(new object(), new EventArgs());
Now go ahead and copypaste the following piece of code

Code:
        int num1 = 6;
        int num2 = 0;
        bool anim1 = false;
        private void handler1_Tick(object sender, EventArgs e)
        {
            //stupid c#
            if (anim1)
            {
                if (second1.Location.Y > 73) { }
                else
                {
                    Point a = second1.Location;
                    a.Y += 3;
                    second1.Location = a;
                }
            }

            Point b = second2.Location;
            b.Y += 3;
            second2.Location = b;
            
        }
        
        void next()
        {
            anim1 = false;
            //jariz's counter code
            if (num1 != 0 && num2 == 0) { num2 = 10; num1--; anim1 = true; }
            num2--;
            second1.Text = num1.ToString();
            second2.Text = num2.ToString();
            if (num1 == 0 && num2 == 0) {  Close(); }
            }
        Point cache1;
        Point cache2;
        private void handler2_Tick(object sender, EventArgs e)
        {
            int i = num1;
            
            second2.Location = cache2;
            next();
            if( i != num1 ) second1.Location = cache1; //reset pos
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            handler1.Stop();
            handler2.Stop();
        }
Reply

#2
Doesn't run very smooth. Also it would be nice if the numbers follow each other without any space in between them.
Reply

#3
nice. but i think you'll agree with me that same countdown would look better in java
[Image: r212360a129ce9b84444093b6cd2699013a1fbn155.png]
Reply

#4
OFC, but guys, this is c#, it's not designed to have animations Tongue
and yeah i could smooth it up a little :Awesome:
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
Thumbs Up Awesome music Nekochan 2 3,173 07-26-2013, 21:49
Last Post: Nekochan
Rainbow [News] Show your awesome mobile device. Nekochan 34 13,958 05-29-2013, 14:59
Last Post: Arteq
Rainbow [News] Show your awesome face Arteq 2 2,775 05-23-2013, 06:11
Last Post: OrangePL
  Show your awesome wallpaper V2 JariZ 81 40,978 04-05-2013, 18:10
Last Post: SuperNovaAO
  Counter-Strike: Warfare d0h! 14 18,905 03-16-2013, 21:10
Last Post: mertkanereli
Big Grin [Release] Awesome Classes modV3.1 ddaavvee 170 239,735 01-24-2013, 23:18
Last Post: KINGOFCRAFT909
  MOAB Counter plastikgangster 11 7,523 11-25-2012, 23:43
Last Post: SuperNovaAO
  Couple awesome songs AZUMIKKEL 2 2,653 08-07-2012, 15:58
Last Post: zxz0O0
  [News] Counter-Strike: GO release date is August 21, $15 price on PC Pozzuh 17 9,168 08-01-2012, 10:42
Last Post: Pozzuh
  [Release] Animated Health Bar from Minecraft Romuald27 2 4,453 07-22-2012, 18:44
Last Post: Romuald27

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.