Link timer to a button

0

Hello, I'm starting to program in C ++ now and I'm developing a college project, it's a periodic table. We think of using a button for each element (118 in total). My goal is to animate the button so that when the mouse goes over it double in size, for that I used a Timer :

private: System::Void timer1_Tick(System::Object^  sender, System::EventArgs^  e) {
        int x = 70;
        if(x <= 140){
            button1->Size = System::Drawing::Size(x, x);
            x += 5;
        }else{ timer1-> Enabled = false;}
    }

    private: System::Void button1_MouseHover(System::Object^  sender, System::EventArgs^  e) {
        timer1 -> Enabled = true;
    }

I tried several things, but until now I could not automate this process, I wanted to create some function that would link the timer event with the button I want to animate, for example:

private: System::Void timer1_Tick(System::Object^  sender, System::EventArgs^  e, System::Windows::Forms::Button^ bt) {
        int x = 70;
        if(x <= 140){
            bt->Size = System::Drawing::Size(x, x);
            x += 5;
        }else{ timer1-> Enabled = false;}
    }

or something like:

scaleUp(System::Windows::Forms::Button^ bt);

private: System::Void button1_MouseHover(System::Object^  sender,    System::EventArgs^  e) {
        scaleUp(button1);
    }

How do you create a solution to the problem without involving 118 timers?

    
asked by anonymous 10.09.2016 / 18:35

0 answers