public DGraph(DNestedGraphLabel parent)
            : base(parent)
        {
            InitializeComponent();

            NeedToCalculateLayout = true;
            ContentEditorProvider = new ContentEditorProvider(this);

            Edges = new List<DEdge>();
            NodeMap = new Dictionary<IComparable, DNode>();

            DrawingLayoutEditor = new LayoutEditor(this);
            DrawingLayoutEditor.ChangeInUndoRedoList += (sender, args) =>
            {
                FirePropertyChanged("CanUndo");
                FirePropertyChanged("CanRedo");
            };

            // I'm doing a slight change to the default toggle entity predicate: I don't want the user to be able to select nodes while I'm in
            // insertion mode. Note that this only concerns the DrawingLayoutEditor, which deals with dragging - by changing the toggle entity
            // predicate, I affect selection of entities while dragging a selection window, NOT selection by simple click. So, this ensures that
            // the user cannot draw a selection window (which doesn't make sense in editing mode), but he can still select single entities by
            // clicking on them.
            var defaultToggleEntityPredicate = DrawingLayoutEditor.ToggleEntityPredicate;
            DrawingLayoutEditor.ToggleEntityPredicate = (modKeys, mButtons, dragPar) => defaultToggleEntityPredicate(modKeys, mButtons, dragPar) && MouseMode != DraggingMode.ComboInsertion && MouseMode != DraggingMode.EdgeInsertion;

            // These decorators are exactly the same as the default ones, but they use my LineWidth fix (see DNode.cs).
            // Once the LineWidth bug in MSAGL is fixed, we should remove these.
            DrawingLayoutEditor.DecorateObjectForDragging = DecorateObjectForDragging;
            DrawingLayoutEditor.RemoveObjDraggingDecorations = RemoveObjDraggingDecorations;

            EdgeRoutingMode = EdgeRoutingMode.Spline;

            MouseMode = DefaultMouseMode = DraggingMode.Pan;

            BeginContentEdit = DefaultBeginContentEdit;
            //EndContentEdit = DefaultEndContentEdit;

            MouseLeftButtonDoubleClick += new EventHandler<MsaglMouseEventArgs>(DGraph_MouseLeftButtonDoubleClick);

            Clear();
        }
        public GraphmapsViewer() {
            layoutEditor = new LayoutEditor(this);

            _graphCanvas.MouseLeftButtonDown += GraphCanvasMouseLeftButtonDown;
            _graphCanvas.MouseRightButtonDown += GraphCanvasRightMouseDown;
            _graphCanvas.MouseMove += GraphCanvasMouseMove;

            _graphCanvas.Focusable = true;
            _graphCanvas.FocusVisualStyle = null;
            _graphCanvas.KeyDown += GraphCanvasKeyDown;
        
            _graphCanvas.MouseLeftButtonUp += GraphCanvasMouseLeftButtonUp;
            _graphCanvas.MouseWheel += GraphCanvasMouseWheel;
            _graphCanvas.MouseRightButtonUp += GraphCanvasRightMouseUp;
            ViewChangeEvent += AdjustBtrectRenderTransform;

            LayoutEditingEnabled = true;
            clickCounter = new ClickCounter(() => Mouse.GetPosition((IInputElement) _graphCanvas.Parent));
            clickCounter.Elapsed += ClickCounterElapsed;

            _hitTestHandler = new HitTestHandler(_graphCanvas);
            CreateRectToFillCanvas();
            _stringFinder = new LgStringFinder(this, (a) => _lgLayoutSettings.GeometryNodesToLgNodeInfos[a.GeometryNode]);
            _tileFetcher = new TileFetcher(this, GetVisibleTilesSet);
        }
 void InitDrawingLayoutEditor(){
     if (LayoutEditor == null){
         LayoutEditor = new LayoutEditor(this);
         LayoutEditor.ChangeInUndoRedoList += DrawingLayoutEditor_ChangeInUndoRedoList;
     }
     undoButton.ImageIndex = (int) ImageEnum.UndoDisabled;
     redoButton.ImageIndex = (int) ImageEnum.RedoDisabled;
 }
        public GraphViewer() {
            //LargeGraphNodeCountThreshold = 0;
            layoutEditor = new LayoutEditor(this);

            _graphCanvas.SizeChanged += GraphCanvasSizeChanged;
            _graphCanvas.MouseLeftButtonDown += GraphCanvasMouseLeftButtonDown;
            _graphCanvas.MouseRightButtonDown += GraphCanvasRightMouseDown;
            _graphCanvas.MouseMove += GraphCanvasMouseMove;

            _graphCanvas.MouseLeftButtonUp += GraphCanvasMouseLeftButtonUp;
            _graphCanvas.MouseWheel += GraphCanvasMouseWheel;
            _graphCanvas.MouseRightButtonUp += GraphCanvasRightMouseUp;
            ViewChangeEvent += AdjustBtrectRenderTransform;
     
            LayoutEditingEnabled = true;
            clickCounter = new ClickCounter(() => Mouse.GetPosition((IInputElement) _graphCanvas.Parent));
            clickCounter.Elapsed += ClickCounterElapsed;
        }