Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
ChingYen  
#1 Posted : Sunday, May 4, 2008 12:37:32 AM(UTC)
ChingYen

Rank: Advanced Member

Groups: Member
Joined: 3/3/2008(UTC)
Posts: 185

Thanks: 8 times
Hi,

May I know how can I create Tooltips for each item in Thumbnail List View?

Or at least some tooltips that will show while I point to the Thunbnail (It can be the same tooltips for all item)
Alex Kon  
#2 Posted : Wednesday, May 7, 2008 1:40:06 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups: Member
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)
Hello,

Yes, of course it is possible. Here is code snippet which shows display name of the thumbnail item in a tool tip. Variable _tl is ThumbnailListView control instance, _toolTip is a System.Windows.Forms.ToolTip instance.

Somewhere in form initialization:
Code:
. . .
_tl.MouseMove += new MouseEventHandler(_tl_MouseMove);
. . .


Mouse move handler and tool tip update method:
Code:
void _tl_MouseMove(object sender, MouseEventArgs e)
{
	UpdateToolTip();
}

private void UpdateToolTip()
{
	int index = _tl.HitTest(_tl.PointToClient(Control.MousePosition));
	if (index != -1)
	{
		string toolTipText = _tl.Items[index].GetText(
			ThumbnailListItem.TextInfoIdDisplayName);
		if (_toolTip.GetToolTip(_tl) != toolTipText)
			_toolTip.SetToolTip(_tl, toolTipText);
	}
	else
	{
		_toolTip.RemoveAll();
	}
}

Edited by user Wednesday, May 7, 2008 3:55:37 PM(UTC)  | Reason: Not specified

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.