Я не на 100% уверен в том, что вы запрашиваете в своем описании, но, похоже, вам нужен один элемент управления с всплывающей подсказкой, заголовок которой зависит от того, над какой частью элемента мыши находится курсор?
Я не могу придумать "хороший" способ сделать это. Код ниже будет работать для метки, но это некрасиво. Лично я бы предпочел создать UserControl с несколькими метками и беспокоиться о том, чтобы вручную расставлять их. Но вот что я получил:
Label lbl = new Label() { Left = 6, Top = 6, AutoSize = true };
this.Controls.Add(lbl);
// Determine the width of each of the "sections" of the Label Text.
// Use the fact that AutoSize = true will increase the Width of the
// Label as you increase the Text Length.
int width = lbl.Width;
lbl.Width = 0;
lbl.Text = string.Empty;
lbl.Text = "x";
int delta = lbl.Width;
lbl.Text += "x";
delta = lbl.Width - 2 * (lbl.Width - delta);
lbl.Text = "ToolTip1";
int txt1Width = lbl.Width - delta;
delta = lbl.Width;
lbl.Text += " NoToolTip ";
int txt2Width = lbl.Width - delta;
delta = lbl.Width;
lbl.Text += "ToolTip2";
int txt3Width = lbl.Width - delta;
// Use a System.Windows.Forms.ToolTip and set the caption on
// MouseHover, depending on the Position of the Cursor.
var tip = new ToolTip();
lbl.MouseHover += delegate(object sender, EventArgs e)
{
tip.RemoveAll();
// Find the Point for the ToolTip (relative to the Label) based
// on the Position of the Cursor.
this.Cursor = new Cursor(Cursor.Current.Handle);
Point lblScreenPos = lbl.PointToScreen(Point.Empty);
Point tipPoint = new Point(Cursor.Position.X, Cursor.Position.Y + lbl.Height);
tipPoint = new Point(tipPoint.X - lblScreenPos.X, tipPoint.Y - lblScreenPos.Y);
// Determine the location of the "sections" of Label text.
int x = tipPoint.X;
int txt1Left = 3;
int txt1Right = txt1Left + txt1Width;
int txt3Left = txt1Right + txt2Width;
int txt3Right = txt3Left + txt3Width;
// Show the ToolTip with the correct caption.
if (x >= txt1Left && x <= txt1Right)
{
tip.Show("TOOLTIPA", lbl, tipPoint, tip.AutoPopDelay);
}
else if (x >= txt3Left && x <= txt3Right)
{
tip.Show("TOOLTIPB", lbl, tipPoint, tip.AutoPopDelay);
}
};
lbl.MouseLeave += delegate(object sender, EventArgs e) { tip.RemoveAll(); };
Подсказка не подчеркнута, и автоматически используется системный шрифт по умолчанию. Это можно изменить только путем рисования всплывающей подсказки владельца. Если вам нужно сделать его синим и подчеркнуть его, проверьте свойство OwnerDraw .