Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Mouse Cursor (Read 3197 times)
nick00
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 44
Joined: Nov 7th, 2008
Mouse Cursor
Feb 16th, 2009 at 8:44pm
Print Post  
Hello,

In my Diagram structure, I have table Nodes with 3 columns, when mouse enter first and third column i want to change the cursor to Hand.

I tried MouseMove of DiagramView but it is not working. Can you suggest me somthing

thanks,
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Mouse Cursor
Reply #1 - Feb 17th, 2009 at 8:08am
Print Post  
Hi,

What have you tried doing in the MouseMove handler? Try converting the mouse position to document coordinates using DiagramView.ClientToDoc(), call Diagram.GetNodeAt() to get the node under the mouse pointer, and if it's a TableNode, call its CellFromPoint() method. If the column index returned == 2, set DiagramView.Cursor or DiagramView.CurrentCursor. The latter might be needed if you want the cursor to change while drawing links.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
nick00
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 44
Joined: Nov 7th, 2008
Re: Mouse Cursor
Reply #2 - Feb 17th, 2009 at 3:07pm
Print Post  
I wrote this piece of code, it hits the Cursors.Hand, but the effect is cursor not remains the same it changes back to arrorw so quickly, even i havent set it back to arrow,

 
Code
Select All
void dlgViewCntRel_MouseMove(object sender, MouseEventArgs e)
	  {
		PointF point = dlgViewCntRel.ClientToDoc(e.Location);
		DiagramNode node = dlgCntRel.GetNodeAt(point);
		if (node != null && m_bTableNodeView)
		{
		    int rNo=-1, cNo=-1;
		    if (((TableNode)node).CellFromPoint(point , ref rNo, ref cNo))
			  if (cNo == 0 || cNo == 2)
				dlgViewCntRel.Cursor = Cursors.Hand;

} 



here is my diagramview settings
Code
Select All
 this.dlgViewCntRel.Behavior = MindFusion.Diagramming.Behavior.DrawControls;
		this.dlgViewCntRel.ControlHandlesStyle = MindFusion.Diagramming.HandlesStyle.HatchHandles;
		this.dlgViewCntRel.ControlMouseAction = MindFusion.Diagramming.ControlMouseAction.IgnoreControl;
		this.dlgViewCntRel.CounterDiagonalResizeCursor = System.Windows.Forms.Cursors.Default;
		this.dlgViewCntRel.DelKeyAction = MindFusion.Diagramming.DelKeyAction.None;
		this.dlgViewCntRel.DiagonalResizeCursor = System.Windows.Forms.Cursors.Default;
		this.dlgViewCntRel.Diagram = this.dlgCntRel;
		this.dlgViewCntRel.HorizontalResizeCursor = System.Windows.Forms.Cursors.Default;
		this.dlgViewCntRel.Location = new System.Drawing.Point(3, 3);
		this.dlgViewCntRel.MiddleButtonActions = MindFusion.Diagramming.MouseButtonActions.None;
		this.dlgViewCntRel.ModificationStart = MindFusion.Diagramming.ModificationStart.SelectedOnly;
		this.dlgViewCntRel.MoveCursor = System.Windows.Forms.Cursors.Arrow;
		this.dlgViewCntRel.Name = "dlgViewCntRel";
		this.dlgViewCntRel.RightButtonActions = MindFusion.Diagramming.MouseButtonActions.Cancel;
		this.dlgViewCntRel.Size = new System.Drawing.Size(831, 418);
		this.dlgViewCntRel.TabIndex = 0;
		this.dlgViewCntRel.Text = "diagramView1";
		this.dlgViewCntRel.VerticalResizeCursor = System.Windows.Forms.Cursors.Default;
		this.dlgViewCntRel.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.dlgViewCntRel_MouseWheel);
		this.dlgViewCntRel.MouseClick += new System.Windows.Forms.MouseEventHandler(this.dlgViewCntRel_MouseClick);
		this.dlgViewCntRel.DoubleClick += new System.EventHandler(this.dlgViewCntRel_DoubleClick);
		this.dlgViewCntRel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.dlgViewCntRel_MouseMove); 

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Mouse Cursor
Reply #3 - Feb 17th, 2009 at 3:31pm
Print Post  
Seems what the control changes to is the DrawLinkCursor, so try setting DiagramView.DrawLinkCursor instead of Cursor.

Stoyan
  
Back to top
 
IP Logged
 
nick00
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 44
Joined: Nov 7th, 2008
Re: Mouse Cursor
Reply #4 - Feb 17th, 2009 at 7:20pm
Print Post  
it worked perfect
what i use is,

Code
Select All
		this.dlgViewCntRel.Behavior = MindFusion.Diagramming.Behavior.DrawShapes;


 void dlgViewCntRel_MouseMove(object sender, MouseEventArgs e)
	  {
		PointF point = dlgViewCntRel.ClientToDoc(e.Location);
		DiagramNode node = dlgCntRel.GetNodeAt(point);
		if (node != null && m_bTableNodeView)
		{
		    if (node.GetType().FullName.Equals("MindFusion.Diagramming.TableNode"))
		    {
			  int rNo = -1, cNo = -1;
			  if (((TableNode)node).CellFromPoint(point, ref rNo, ref cNo))
				if (rNo == 0 || rNo == 2)
				    dlgViewCntRel.PointerCursor = Cursors.Hand;
			  else
				    dlgViewCntRel.PointerCursor = Cursors.Arrow;

		    }
		    else
			  dlgViewCntRel.PointerCursor = Cursors.Arrow;
		}
		else
		    dlgViewCntRel.PointerCursor = Cursors.Arrow;
		} 

  
Back to top
 
IP Logged
 
MUDO
Junior Member
**
Offline



Posts: 90
Joined: Nov 29th, 2008
Re: Mouse Cursor
Reply #5 - May 16th, 2009 at 4:56pm
Print Post  
Hi.

I have similar problem. I would like to draw rectangle around cell and row (both) under cursor.

- where I know bounds (X&Y position, width and height of course) of cell and row from?
- how to obtain Graphics object from node? I guess I need to draw on it.
Becuase this solution (drawing on diagramview) is not very good idea I think Sad

Code
Select All
Dim LoHwnd As IntPtr = Me.fcDiagramView.Handle
Dim LoGraphics As System.Drawing.Graphics = Graphics.FromHwnd(LoHwnd)

LoGraphics.DrawRectangle(SDPenVirginCreator(Color.Red, 2), 0, 0, 100, 100)
 



Thx.

...MUDO...
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Mouse Cursor
Reply #6 - May 18th, 2009 at 1:28pm
Print Post  
You could set CellCustomDraw = Additional and handle the DrawCell event to draw a rectangle around the cell when the mouse pointer is over it. Then you'd have to call Diagram.Invalidate(table.Bounds) from the MouseMove handler. Another possibility is to do that from the DrawForeground handler; we'll have to make an internal GetCellRect method public to let you do that easily.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint