Accesing variable/function in Control using (Control)Sender

Jul 20 2008 11:09 PM

Hi,

I've created a partial class : Control for designing the shape of my polygon.
It works well but there's one problem that I tried to find on net but I get nothing.

I've created one int named 'size'. Then I created a function named 'Growing' for 'get' and 'set'.
When I created an object from that class, I just type on the object name.Growing, then I can 'get' the size and 'set' the size.
This no problem.

The problem exist when I created as follow:


private void Grow(object sender, EventArgs e)
{
 Control controlAll =  (Control)sender; 
 
}

This 'controlAll' is use to track which polygon I choose.
but when I run this line of code, it seems like controlAll can't get to the function I declared in the class "Growing"

controlAll.Growing = 50;   // ERROR WENT HERE

 

Is there any ways to make the control to identified the function that I created in the class ? Any idea ? 


Answers (1)