Reputation: 231
I would like to start with stating that my "skillZ" in C# is rather basic.
So, I am trying to add a tooltip
to the selected item in a listbox
, this will happen when a user clicks on the item in question.
So my inquiry as to if my usage of PointToClient
is correct, since I think there is where the problem lies. Or am I totally wrong(which probably is the case)?
public void Listb_SelectedIndexChanged(object sender, EventArgs e)
{
ToolTip tooltip = new ToolTip();
ListBox temp = sender as ListBox;
Point mouseLocation = Control.MousePosition;
Form.ActiveForm.PointToClient(mouseLocation);
int idx = (int)temp.Tag;
tooltip.Show(DaysList[idx].Elements[temp.SelectedIndex].EventDate, temp, mouseLocation);
}
Thanks in advance.
Upvotes: 2
Views: 209
Reputation: 787
Since the tooltips position refers to the input control in the show() constructor, you don't need to care about the main forms location. Just skip the part with "PointToClient" and you'll be fine!
Upvotes: 1