I'm not sure what you mean about cannot find the Controls property. However, it is not listed if you just search "Button." in the MSDN "Look For" list, you need to select the Control.
This sample should demonstrate putting a button inside another button.
Button button1 = new Button();
button1.Text = "Button 1";
button1.Size = new Size(100, 100);
form1.Controls.Add(button1);
Button button2 = new Button();
button2.Text = "Button 2";
button1.Controls.Add(button2);
button2.Click += new EventHandler(button2_Click);
....
private void button2_Click(object sender, EventArgs e)
{
MessageBox.Show(((Button)sender).Parent.Text);
}
Note that if you just drag a button over another button in the Designer window, the designer won't actually put the button inside the other button but onto the underlying form. I suppose the designer assumes you don't want Button2 inside Button1.
[quoted text, click to view] On Fri, 06 May 2005 14:33:25 +0200, Stan <jazz.stanley@msa.hinet.net> wrote:
> Hi,
>
> As you mentioned, I'v tried to get "Controls Property" from "Button" but I
> can find!?
> I'm not very clear about your concept.
>
> My scenario:
>
> 1.Put Button1 on form1;
> 2.Put Button2 over Button1;
> 3.User "Button2.Parent" to find Button2's parent;
> 4.I got "form1" , not "Button1"!
>
> If the same scenario but change "Button1" to "Panel1" then I'll get
> "Panel1" as Button2's parent.
>
> So if I want to make "Button1" as Button2's parent, how can I do?
>
> Thanks for your kind response!
>
>
> "Morten Wennevik" <MortenWennevik@hotmail.com> ???
> news:op.sqcl31hnklbvpo@stone ???...
>> Hi Stan,
>>
>> Basically all Controls can be containers as Control has a Controls
> property. You can put a button inside another button if you like. Or a
> TextBox that has Button with another TextBox inside of it.
>>
>>
>> --
>> Happy coding!
>> Morten Wennevik [C# MVP]
>
>
>
--
Happy coding!