开发者

previous tooltips remain on mouse move, and don't refresh!

in C#.NET winodws forms i handled manual tooltip texts for different ListBox items like this:

开发者_高级运维
private void lstFields_MouseMove(object sender, MouseEventArgs e)
        {

            ListBox lstBox = (ListBox)sender;
            Point listBoxClientAreaPosition = lstBox.PointToClient(System.Windows.Forms.Cursor.Position);
            int idx = lstBox.IndexFromPoint(listBoxClientAreaPosition);
            if (idx == -1)
            {
                //toolTip1.SetToolTip(lstBox, null);
                toolTip1.Hide(lstBox);
                return;
            }
            Field fld = (Field)lstBox.Items[idx];
            string strTooltip = string.Format("Descriptor: {0} , ISO Field Number: {1} , Custom Value : {2}",fld.FieldDescriptor,fld.ISOFieldNumber,fld.CustomValue);
            if (toolTip1.GetToolTip(lstBox) == strTooltip)
            {
                return;
            }

            toolTip1.SetToolTip(lstBox, strTooltip);
        }

it works, but the previously shown tooltips don't hide when i move the mouse fast. what should i do?


Check this article by me Here

Write another namely Mouse_Leave and hide all the tool tips that you don't want to show

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜