Esempio n. 1
0
        private void InitializeSnapping()
        {
            // Initialize snapping state
            SnappingEnabled = snappingButton.Checked;

            // Initialize SnapContext
            GraphEditorInputMode geim = graphControl.InputMode as GraphEditorInputMode;

            if (geim != null)
            {
                graphSnapContext = new GraphSnapContext
                {
                    // disable snapping features as shown in previous tutorial step
                    // so they won't distract from grid snapping.
                    // Please note that snapping and grid snapping
                    // can be used together
                    Enabled = SnappingEnabled,
                    SnapBendAdjacentSegments = false,
                    SnapBendsToSnapLines     = false,
                    SnapNodesToSnapLines     = false,
                    SnapOrthogonalMovement   = false,
                    SnapPortAdjacentSegments = false,
                    SnapSegmentsToSnapLines  = false
                };
                labelSnapContext = new LabelSnapContext
                {
                    Enabled = SnappingEnabled,
                };
                geim.SnapContext      = graphSnapContext;
                geim.LabelSnapContext = labelSnapContext;
            }
        }
        /// <summary>
        /// Creates a pre-configured <see cref="LabelSnapContext"/> for this demo.
        /// </summary>
        protected virtual LabelSnapContext CreateLabelSnapContext()
        {
            var snapContext = new LabelSnapContext
            {
                SnapDistance = 10,
                CollectInitialLocationSnapLines = false
            };

            snapContext.CollectSnapLines += CollectAdditionalLabelSnapLines;

            return(snapContext);
        }
        private void InitializeSnapping()
        {
            // Initializes snapping state
            SnappingEnabled = snappingButton.Checked;

            // Initializes SnapContext
            GraphEditorInputMode geim = graphControl.InputMode as GraphEditorInputMode;

            if (geim != null)
            {
                graphSnapContext = new GraphSnapContext
                {
                    Enabled = SnappingEnabled,
                };
                labelSnapContext = new LabelSnapContext
                {
                    Enabled = SnappingEnabled,
                };
                geim.SnapContext      = graphSnapContext;
                geim.LabelSnapContext = labelSnapContext;
            }
        }