Hi guys,
I am trying to write down a generic Class where I will be able to pass a form and that class handle the basic settings of the form's Controls. Eg set the Font, color, size, style etc.
2 issues here:
1- How can I get a from in my class constructor to have access to all its controls? It should be generic to get an Windows Form. i tryed even i declared the controls as Public however i couldn't access the controls. In the constructor i was getting it as:
class Setter(System.Windows.Forms frm) ??
If it is not possible I would like to do it in each form seperately.
2- Let is say i want to loop through all the controls in the form and if the control is textbox set some properties, if its button set some others ... something like:
if (Contol.typeof(Button))
//set stuff
elseif (Contol.typeof(textbox))
//set stuff
etc
Has anyone tryed it at all? Is it possible?
any comments, hints will be appreciated.
TA
I am trying to write down a generic Class where I will be able to pass a form and that class handle the basic settings of the form's Controls. Eg set the Font, color, size, style etc.
2 issues here:
1- How can I get a from in my class constructor to have access to all its controls? It should be generic to get an Windows Form. i tryed even i declared the controls as Public however i couldn't access the controls. In the constructor i was getting it as:
class Setter(System.Windows.Forms frm) ??
If it is not possible I would like to do it in each form seperately.
2- Let is say i want to loop through all the controls in the form and if the control is textbox set some properties, if its button set some others ... something like:
if (Contol.typeof(Button))
//set stuff
elseif (Contol.typeof(textbox))
//set stuff
etc
Has anyone tryed it at all? Is it possible?
any comments, hints will be appreciated.
TA