E
Efkas
I have a Win Form app, calling the consctructor of a class. Inside
the class, I declare some stuff like new Label, etc. I want to add
this label inside the constructor in the windows form by
xxx.Control.Add(label). Sure I can pass this.Control in parameter in
my constructor from my windows form and it works, but I don't want to
do that. Is there any method or function that allow retreive who
call the constructor?
I also don't want to use User Control.
there is a sample of what I am trying to do
{
...
// MyApp Winform
MyCie.MyProd.MyGroupLabel glabel = new MyCie.MyProd.MyGroupLabel()
...
}
// Class MyGroupLabel
MyCie.MyProd.MyGroupLabel
{
class MyGroupLabel
{
public MyGroupLabel()
{
Label tomatoLabel = new Label();
Label potatoeLabel = new Label();
tomatoLabel.Text = "Tomatoe";
potatoeLabel.Text = "Potatoe";
tomatoLabel.SetBounds(.....);
potatoeLabel.SetBounds(.....);
// Get the object that call this constructor ... how to do that!?
// and add it in the windows form at set bounds
UnknownFunctionGetxxx().Controls.Add(tomatoLabel );
UnknownFunctionGetxxx().Controls.Add(potatoeLabel);
}
}
}
*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
the class, I declare some stuff like new Label, etc. I want to add
this label inside the constructor in the windows form by
xxx.Control.Add(label). Sure I can pass this.Control in parameter in
my constructor from my windows form and it works, but I don't want to
do that. Is there any method or function that allow retreive who
call the constructor?
I also don't want to use User Control.
there is a sample of what I am trying to do
{
...
// MyApp Winform
MyCie.MyProd.MyGroupLabel glabel = new MyCie.MyProd.MyGroupLabel()
...
}
// Class MyGroupLabel
MyCie.MyProd.MyGroupLabel
{
class MyGroupLabel
{
public MyGroupLabel()
{
Label tomatoLabel = new Label();
Label potatoeLabel = new Label();
tomatoLabel.Text = "Tomatoe";
potatoeLabel.Text = "Potatoe";
tomatoLabel.SetBounds(.....);
potatoeLabel.SetBounds(.....);
// Get the object that call this constructor ... how to do that!?
// and add it in the windows form at set bounds
UnknownFunctionGetxxx().Controls.Add(tomatoLabel );
UnknownFunctionGetxxx().Controls.Add(potatoeLabel);
}
}
}
*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*