Exemplo n.º 1
0
        private void d2dControl_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.None && AdaptedControl.Focused)
            {
                IPickingAdapter2 pickAdapter = this as IPickingAdapter2;
                var    hoverHitRecord        = pickAdapter.Pick(e.Location);
                object item = hoverHitRecord.Item;

                bool redraw = false;
                if (m_hoverObject != item)
                {
                    m_hoverObject = item;
                    redraw        = true;
                }
                if (m_hoverSubObject != hoverHitRecord.SubItem)
                {
                    ResetCustomStyle(m_hoverSubObject);
                    m_hoverSubObject = hoverHitRecord.SubItem;
                    m_renderer.SetCustomStyle(m_hoverSubObject, DiagramDrawingStyle.DragSource);

                    redraw = true;
                }

                if (redraw)
                {
                    Invalidate();
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Performs a picking operation on the graph with the point</summary>
        /// <param name="p">Hit test point in screen space</param>
        /// <returns>Hit record resulting from picking operation</returns>
        public GraphHitRecord <TNode, TEdge, TEdgeRoute> Pick(Point p)
        {
            IPickingAdapter2 pickAdapter = (IPickingAdapter2)this;

            return((GraphHitRecord <TNode, TEdge, TEdgeRoute>)pickAdapter.Pick(p));
        }