[ProgressBar movement] !

If you have completed an application and wish to share the complete source/project files with everyone then please post it in here. Source-code files only, no tutorials.
5 posts Page 1 of 1
Contributors
User avatar
DreadNought
VIP - Donator
VIP - Donator
Posts: 116
Joined: Fri Jan 08, 2010 12:37 pm

[ProgressBar movement] !
DreadNought
Okay,

I got bored, Just making a test application with VS2011 BETA.

This will increase based on mathematical calculations, I will actually make this fully random so no increase is the same, However I got bored, and thought I would share

Code:
Code: Select all

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        int valInc = 0;
        private void timer1_Tick(object sender, EventArgs e)
        {
            valInc = valInc * 2 + 1;
            int val = progressBar1.Value * valInc / 5 + 3;
            if (val > 100)
                progressBar1.Value = 100;
            else
                progressBar1.Value = val;
            timer1.Interval = timer1.Interval / 2;
            if (timer1.Interval <= 1000)
                timer1.Interval = 2000;
            if (progressBar1.Value > 20)
            {
                timer1.Interval = 3000;
            }
                if (progressBar1.Value >= 100)
                timer1.Stop();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            timer1.Interval = 3000;
            timer1.Enabled = true;
            timer1.Start();
        }
    }
}

Bound and boom tech,
The Future Of Coding
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

Re: [ProgressBar movement] !
MrAksel
I'm sure this is something everyone will use :lol: Goood job!
But you know you don't need both timer1.Enabled = true and timer1.Start(); ? Its enough with one of them.
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
User avatar
DreadNought
VIP - Donator
VIP - Donator
Posts: 116
Joined: Fri Jan 08, 2010 12:37 pm

Re: [ProgressBar movement] !
DreadNought
no I did not, but thankyou, I'm more of a threading guy :)

Without checking, I believe only the Start(); method will invoke Enabled to true automatically, but Enabled will not invoke Start()? I honestly don't know, I'm by no means a GUI Wiz.
Bound and boom tech,
The Future Of Coding
User avatar
M1z23R
VIP - Donator
VIP - Donator
Posts: 622
Joined: Tue Sep 28, 2010 4:55 pm

Re: [ProgressBar movement] !
M1z23R
If .start enables the timer why would enable invoke start ? It would go in circles and overload :D
User avatar
DreadNought
VIP - Donator
VIP - Donator
Posts: 116
Joined: Fri Jan 08, 2010 12:37 pm

Re: [ProgressBar movement] !
DreadNought
That is why I said .Enabled probably doesn't invoke the start, but it wouldn't matter because they probably check if it's started already and disable the start method going twice.
Bound and boom tech,
The Future Of Coding
5 posts Page 1 of 1
Return to “Source-Code”