is it possible to show GUI (pannel + TextBox) through Class?
is it possible to开发者_StackOverflow中文版 show GUI (pannel + TextBox) through Class ?
i need that from my class i can show pannel and textbox on the main Form
thank's in advance
You can build the gui through code, for example to add a TextBox to a Panel, and the Panel to your Form, you can write some c# code like:
TextBox tb=new TextBox();
tb.Location=new Point(10,10);
Panel pn=new Panel();
pn.Dock=DockStyle.Fill;
pn.Controls.Add(tb);
this.Controls.Add(pn);//this is your form Instance
If you need to show the panel and the textbox on an existing form, then the code which wants to show it has to know about the form.
Obviously it's hard to say without more context, but you might want to consider putting the "show a panel and textbox" code in the form class itself - then just call that method from the piece of code which triggers this. Obviously that code will need a reference to the relevant instance of the form; I really can't say the best way of propagating that information without knowing more about the situation.
I'm not sure i understand your question correctly but it is possible to bind objects to .NET controls like in this tutorial
精彩评论