我一定很傻,但是
ToolTip tooltip = new ToolTip();
// tooltip.Name << not exists, lol
我需要它来做这样的事情:
public partial class MyForm : Form
{
private void InitializeComponent()
{
...
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.toolTip2 = new System.Windows.Forms.ToolTip(this.components);
...
}
private void SomeMethodOfForm()
{
SomeMethodOfClassA(components);
}
}
public class A
{
public static SomeMethodOfClassA(IContainer container)
{
foreach (Component component in container.Components)
if (component is ToolTip)
MessageBox.Show("Found ToolTip"); // want to show here "toolTip1" or "toolTip2"
}
}
我该怎么办?设计师ToolTip.Name
以某种方式展示。如何?