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 25, 2008 9:05:49 AM(UTC)
ChingYen

Rank: Advanced Member

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

Thanks: 8 times
Hi,

Just wondering, is that possible to add tooltips to the VObject "Marking"?
Such as "Drag here to resize" (On the 4 points), "Drag here to rotate" (On the side circle). Please advice.

Alex Kon  
#2 Posted : Friday, May 30, 2008 3:44:03 PM(UTC)
Alex Kon

Rank: Advanced Member

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

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

Yes, of course.

The idea is to get currently selected object and check all its control points with current mouse position. If you are using Aurigma vector objects, most of them have the same points order, so in the sample below I use index of the point. In case of custom objects you will have to change the logic according to your implementation.

Code:
Private Sub _mlv_MouseMove(ByVal sender As Object, ByVal e As _
	System.Windows.Forms.MouseEventArgs) Handles _mlv.MouseMove
	UpdateTooltip()
End Sub

Private Sub UpdateTooltip()
	Dim toolTipText = ""

	If _mlv.CurrentDesigner.VObjects.Length > 0 Then
		Dim obj As Aurigma.GraphicsMill.WinControls.IVObject = _
			 _mlv.CurrentDesigner.VObjects(0)

		For i As Integer = 0 To obj.ControlPoints.Count - 1
			If obj.ControlPoints(i).HitTest( _
			 _mlv.PointToClient(Control.MousePosition), _mlv) Then
				If i >= 1 And i <= 8 Then
					toolTipText = "Drag here to resize"
				ElseIf i >= 9 And i <= 12 Then
					toolTipText = "Drag here to rotate"
				ElseIf i >= 13 And i <= 16 Then
					toolTipText = "Drag here to skew"
				End If

				Exit For
			End If
		Next
	End If

	_toolTip.SetToolTip(_mlv, toolTipText)
End Sub


Code:
void _mlv_MouseMove(object sender, MouseEventArgs e)
{
	UpdateToolTip();
}

private void UpdateToolTip()
{
	string text = "";
	if (_mlv.CurrentDesigner.VObjects.Length > 0)
	{
		Aurigma.GraphicsMill.WinControls.IVObject obj = 
			_mlv.CurrentDesigner.VObjects[0];
		for (int i = 0; i < obj.ControlPoints.Count; i++)
			if (obj.ControlPoints[i].HitTest(
				_mlv.PointToClient(Control.MousePosition), 
				_mlv))
			{
				if (i >= 1 && i <= 8)
					text = "Drag here to resize";
				else if (i >= 9 && i <= 12)
					text = "Drag here to rotate";
				else if (i >= 13 && i <= 16)
					text = "Drag here to skew";
				break;
			}
	}
	_toolTip.SetToolTip(_mlv, text);
}

Edited by user Friday, May 30, 2008 3:46:18 PM(UTC)  | Reason: Not specified

Users browsing this topic
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.