protected void ChangeCurrentShapeShadow(string webControlId, System.Web.HttpContext context, NStateObject state, EventArgs args)
            {
                NDiagramSessionStateObject diagramState = state as NDiagramSessionStateObject;

                NNodeList allShapes = diagramState.Document.ActiveLayer.Children(Nevron.Diagram.Filters.NFilters.Shape2D);

                NNodeList affectedNodes  = diagramState.HitTest(args as NCallbackMouseEventArgs);
                NNodeList affectedShapes = affectedNodes.Filter(Nevron.Diagram.Filters.NFilters.Shape2D);

                int    length;
                NShape shape;

                length = allShapes.Count;
                for (int i = 0; i < length; i++)
                {
                    shape = allShapes[i] as NShape;
                    shape.Style.ShadowStyle = null;
                }

                if (affectedShapes.Count == 0)
                {
                    return;
                }

                shape = affectedShapes[affectedShapes.Count - 1] as NShape;
                if (shape.Style.StrokeStyle == null)
                {
                    shape.Style.ShadowStyle = new NShadowStyle(ShadowType.GaussianBlur, Color.FromArgb(96, Color.Black), new NPointL(3, 3), 1, new NLength(10));
                }
            }
            public override void OnAsyncClick(string webControlId, System.Web.HttpContext context, NStateObject state, NCallbackMouseEventArgs args)
            {
                NDiagramSessionStateObject diagramState = state as NDiagramSessionStateObject;
                NNodeList clickedNodes  = diagramState.HitTest(args);
                NNodeList clickedShapes = clickedNodes.Filter(Nevron.Diagram.Filters.NFilters.Shape2D);

                NNodeList shapes = diagramState.Document.ActiveLayer.Children(Nevron.Diagram.Filters.NFilters.Shape2D);
                int       length = shapes.Count;

                for (int i = 0; i < length; i++)
                {
                    NShape s = shapes[i] as NShape;
                    s.Style.FillStyle   = null;
                    s.Style.StrokeStyle = null;
                    s.Style.ShadowStyle = null;
                    s.Tag = null;
                }

                if (clickedShapes.Count == 0)
                {
                    return;
                }

                NShape clickedShape = clickedShapes[0] as NShape;

                clickedShape.Style.FillStyle   = new NColorFillStyle(libraryHighlightFillColor);
                clickedShape.Style.StrokeStyle = new NStrokeStyle(libraryHighlightBorderColor);
                clickedShape.Style.ShadowStyle = new NShadowStyle(ShadowType.GaussianBlur, Color.FromArgb(90, Color.Black), new NPointL(2, 1));
                clickedShape.Tag = "selected";
            }
            protected void OnMouseEvent(string webControlId, System.Web.HttpContext context, NStateObject state, NCallbackMouseEventArgs args)
            {
                NDiagramSessionStateObject diagramState = state as NDiagramSessionStateObject;

                NNodeList allShapes = diagramState.Document.ActiveLayer.Children(Nevron.Diagram.Filters.NFilters.Shape2D);

                NNodeList affectedNodes  = diagramState.HitTest(args);
                NNodeList affectedShapes = affectedNodes.Filter(Nevron.Diagram.Filters.NFilters.Shape2D);

                int length;

                length = allShapes.Count;
                for (int i = 0; i < length; i++)
                {
                    NShape shape = allShapes[i] as NShape;
                    shape.Style.ShadowStyle = null;
                    if (shape.Tag != null)
                    {
                        shape.Style.FillStyle = new NColorFillStyle((Color)shape.Tag);
                    }
                }

                length = affectedShapes.Count;
                for (int i = 0; i < length; i++)
                {
                    NShape shape = affectedShapes[i] as NShape;
                    shape.Style.ShadowStyle = new NShadowStyle(ShadowType.GaussianBlur, Color.FromArgb(96, Color.Black), new NPointL(3, 3), 1, new NLength(10));
                    NColorFillStyle fs = shape.Style.FillStyle as NColorFillStyle;
                    if (fs != null && fs.Color != Color.White)
                    {
                        shape.Tag             = fs.Color;
                        shape.Style.FillStyle = new NColorFillStyle(Color.YellowGreen);
                    }
                }
            }
Beispiel #4
0
            protected NRectangleShape HitTestCell(NStateObject state, NCallbackMouseEventArgs args)
            {
                NDiagramSessionStateObject diagramState = state as NDiagramSessionStateObject;
                NNodeList nodes  = diagramState.HitTest(args);
                NNodeList shapes = nodes.Filter(Nevron.Diagram.Filters.NFilters.Shape2D);

                foreach (NShape node in shapes)
                {
                    if (!(node.Tag is CellState))
                    {
                        continue;
                    }
                    return(node as NRectangleShape);
                }

                return(null);
            }
            protected NEllipseShape HitTestEllipse(NStateObject state, NCallbackMouseEventArgs args)
            {
                NDiagramSessionStateObject diagramState = state as NDiagramSessionStateObject;
                NNodeList nodes  = diagramState.HitTest(args);
                NNodeList shapes = nodes.Filter(Nevron.Diagram.Filters.NFilters.Shape2D);

                foreach (NShape node in shapes)
                {
                    if (!(node is NEllipseShape))
                    {
                        continue;
                    }
                    if (!node.Name.Contains("Ellipse"))
                    {
                        continue;
                    }
                    return(node as NEllipseShape);
                }

                return(null);
            }
            protected void ChangeCurrentShapeColor(string webControlId, System.Web.HttpContext context, NStateObject state, EventArgs args, Color c)
            {
                NDiagramSessionStateObject diagramState = state as NDiagramSessionStateObject;

                NNodeList allShapes = diagramState.Document.ActiveLayer.Children(Nevron.Diagram.Filters.NFilters.Shape2D);

                NNodeList affectedNodes  = diagramState.HitTest(args as NCallbackMouseEventArgs);
                NNodeList affectedShapes = affectedNodes.Filter(Nevron.Diagram.Filters.NFilters.Shape2D);

                int    length;
                NShape shape;

                length = allShapes.Count;
                for (int i = 0; i < length; i++)
                {
                    shape = allShapes[i] as NShape;
                    if (shape.Tag != null)
                    {
                        shape.Style.FillStyle = shape.Tag as NAdvancedGradientFillStyle;
                    }
                }

                if (affectedShapes.Count == 0)
                {
                    return;
                }

                shape = affectedShapes[affectedShapes.Count - 1] as NShape;
                NAdvancedGradientFillStyle fs = shape.Style.FillStyle as NAdvancedGradientFillStyle;

                if (fs != null)
                {
                    shape.Tag             = fs;
                    shape.Style.FillStyle = new NColorFillStyle(c);
                }
            }