/// <summary> /// /// </summary> /// <param name="e"></param> protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); Point pt = new Point(e.X, e.Y); // check the area and paint the background of it when needed foreach (Rectangle rectangle in m_MapBtn2Node.Keys) { if (rectangle.Contains(pt) == false) { continue; } // get the node and show the menu with subnodes of the node Node node = m_MapBtn2Node[rectangle] as Node; if (node == null) { m_HighlightRect = rectangle; m_HighlightRectType = HighlightRectType.Full; Invalidate(); return; } m_HighlightRect = rectangle; if (node.Nodes.Count != 0) { // check the exact mouse position and determine if the area is text area or // drop down button area, then it will be painted differently. if (pt.X < rectangle.Right - 12) { m_HighlightRectType = HighlightRectType.Left; } else { m_HighlightRectType = HighlightRectType.Right; } } else { m_HighlightRectType = HighlightRectType.Full; } Invalidate(); return; } m_HighlightRect = Rectangle.Empty; Invalidate(); }
/// <summary> /// /// </summary> /// <param name="e"></param> protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove (e); Point pt = new Point(e.X, e.Y); // check the area and paint the background of it when needed foreach (Rectangle rectangle in m_MapBtn2Node.Keys) { if (rectangle.Contains(pt) == false) continue; // get the node and show the menu with subnodes of the node Node node = m_MapBtn2Node[rectangle] as Node; if (node == null) { m_HighlightRect = rectangle; m_HighlightRectType = HighlightRectType.Full; Invalidate(); return; } m_HighlightRect = rectangle; if (node.Nodes.Count != 0) { // check the exact mouse position and determine if the area is text area or // drop down button area, then it will be painted differently. if (pt.X < rectangle.Right - 12) m_HighlightRectType = HighlightRectType.Left; else m_HighlightRectType = HighlightRectType.Right; } else m_HighlightRectType = HighlightRectType.Full; Invalidate(); return; } m_HighlightRect = Rectangle.Empty; Invalidate(); }