私はこれで立ち往生しています。Form を拡張する独自のクラスに ToolTip を追加する必要があります。また、動的コントロールのコードでも行う必要があります。
私が今持っているものは次のようなものです:
public class MyForm : Form
{
private ToolTip _toolTip;
public MyForm()
: base()
{
setup();
}
public MyForm(string Name)
: base()
{
setup();
if (Name != null)
{
this.myName = Name;
this.Load += new EventHandler(_Load);
this.Resize +=new EventHandler(_Resize);
addMovable(); //This adds the mouse listeners aswell.
}
}
private void setup()
{
...
this._toolTip = new ToolTip();
}
public void SetToolTip(Control control, string caption)
{
this._toolTip.SetToolTip(control, caption);
}
...
}
そして、私はこのようなものからそれを呼び出します。
public void Edit(XmlNode aNode)
{
XmlNodeList myNodes = aNode.ChildNodes;
MyForm myForm = new MyForm("EditRollset");
Button aButton;
...
A loop for myNodes..
{...
aButton = new Button();
aButton.Click += new System.EventHandler(btn_Click);
myForm.SetToolTip(aButton,"FooXMLText");
myForm.Controls.Add(aButton);
}
...
myForm.Show();
エラーなどは発生しません。機能しません。助けてください。