private void InitDocument() { // Set up visual formatting document.BackgroundStyle.FrameStyle.Visible = false; // Create the stylesheets int i = 0, count = COLORS.Length; m_Cells = new int[count]; for (i = 0; i < count; i++) { NStyleSheet styleSheet = new NStyleSheet(COLORS[i].ToString()); NStyle.SetFillStyle(styleSheet, new NAdvancedGradientFillStyle(COLORS[i], 4)); document.StyleSheets.AddChild(styleSheet); cells[i] = 0; } // Create the table score = 0; CreateTableShape(); CreateInfoShape(); table.Location = new NPointF(info.Bounds.Right + info.Width / 2, table.Location.Y); // Resize the document to fit all shapes document.SizeToContent(); document.Tag = m_Cells; document.ActiveLayer.Tag = m_Score; }
private NCompositeShape CreateVerticalPipe() { NDynamicPort port; NCompositeShape shape = new NCompositeShape(); NRectanglePath rect = new NRectanglePath(SIZE, 0, SIZE, 3 * SIZE); NStyle.SetStrokeStyle(rect, new NStrokeStyle(0, Color.White)); shape.Primitives.AddChild(rect); shape.Primitives.AddChild(new NLinePath(SIZE, 0, SIZE, 3 * SIZE)); shape.Primitives.AddChild(new NLinePath(2 * SIZE, 0, 2 * SIZE, 3 * SIZE)); shape.UpdateModelBounds(); if (shape.Ports == null) { shape.CreateShapeElements(ShapeElementsMask.Ports); } port = new NDynamicPort(shape.UniqueId, TOP, DynamicPortGlueMode.GlueToContour); port.Type = PortType.InwardAndOutward; shape.Ports.AddChild(port); port = new NDynamicPort(shape.UniqueId, BOTTOM, DynamicPortGlueMode.GlueToContour); port.Type = PortType.InwardAndOutward; shape.Ports.AddChild(port); SetProtections(shape); return(shape); }
private void CreateTextShape(ref NShape shape) { shape = new NRectangleShape(0, 0, SEAT_SIZE.Width * 10, SEAT_SIZE.Height); NStyle.SetFillStyle(shape, new NColorFillStyle(Color.White)); NStyle.SetStrokeStyle(shape, new NStrokeStyle(0, Color.White)); NStyle.SetTextStyle(shape, new NTextStyle()); shape.Style.TextStyle.StringFormatStyle = new NStringFormatStyle(StringFormatType.GenericTypographic, HorzAlign.Left, VertAlign.Center); SetProtections(shape); document.ActiveLayer.AddChild(shape); }
private void CreateScene(NDrawingDocument document) { document.BackgroundStyle.FrameStyle.Visible = false; document.Style.TextStyle.FontStyle.InitFromFont(new Font("Arial Narrow", 8)); NNetworkShapesFactory factory = new NNetworkShapesFactory(document); factory.DefaultSize = new NSizeF(240, 180); NShape server = factory.CreateShape(NetworkShapes.Server); NShape computer = factory.CreateShape(NetworkShapes.Computer); NShape laptop = factory.CreateShape(NetworkShapes.Laptop); document.ActiveLayer.AddChild(server); document.ActiveLayer.AddChild(computer); document.ActiveLayer.AddChild(laptop); NRoutableConnector link1 = new NRoutableConnector(); document.ActiveLayer.AddChild(link1); link1.FromShape = server; link1.ToShape = computer; NRoutableConnector link2 = new NRoutableConnector(); document.ActiveLayer.AddChild(link2); link2.FromShape = server; link2.ToShape = laptop; // layout the shapes in the active layer using a table layout NLayeredGraphLayout layout = new NLayeredGraphLayout(); // get the shapes to layout NNodeList shapes = document.ActiveLayer.Children(NFilters.Shape2D); // layout the shapes layout.Layout(shapes, new NDrawingLayoutContext(document)); // resize document to fit all shapes document.SizeToContent(); // add the data shape const float shapeSize = 10; NEllipseShape data = new NEllipseShape(link2.EndPoint.X - shapeSize / 2, link2.EndPoint.Y - shapeSize, shapeSize, shapeSize); document.ActiveLayer.AddChild(data); NStyle.SetStrokeStyle(data, new NStrokeStyle(0, KnownArgbColorValue.Transparent)); NStyle.SetFillStyle(data, new NColorFillStyle(KnownArgbColorValue.Red)); // set the animations style SetAnimationsStyle(data, link1, link2); // resize document to fit all shapes document.SizeToContent(); }
private NCompositeShape CreateCrossPipe() { NDynamicPort port; NCompositeShape shape = new NCompositeShape(); NPolygonPath polygon = new NPolygonPath(new NPointF[] { new NPointF(0, SIZE), new NPointF(SIZE, SIZE), new NPointF(SIZE, 0), new NPointF(2 * SIZE, 0), new NPointF(2 * SIZE, SIZE), new NPointF(3 * SIZE, SIZE), new NPointF(3 * SIZE, 2 * SIZE), new NPointF(2 * SIZE, 2 * SIZE), new NPointF(2 * SIZE, 3 * SIZE), new NPointF(SIZE, 3 * SIZE), new NPointF(SIZE, 2 * SIZE), new NPointF(0, 2 * SIZE) }); NStyle.SetStrokeStyle(polygon, new NStrokeStyle(0, Color.White)); shape.Primitives.AddChild(polygon); shape.Primitives.AddChild(new NLinePath(0, SIZE, SIZE, SIZE)); shape.Primitives.AddChild(new NLinePath(SIZE, SIZE, SIZE, 0)); shape.Primitives.AddChild(new NLinePath(2 * SIZE, 0, 2 * SIZE, SIZE)); shape.Primitives.AddChild(new NLinePath(2 * SIZE, SIZE, 3 * SIZE, SIZE)); shape.Primitives.AddChild(new NLinePath(3 * SIZE, 2 * SIZE, 2 * SIZE, 2 * SIZE)); shape.Primitives.AddChild(new NLinePath(2 * SIZE, 2 * SIZE, 2 * SIZE, 3 * SIZE)); shape.Primitives.AddChild(new NLinePath(SIZE, 3 * SIZE, SIZE, 2 * SIZE)); shape.Primitives.AddChild(new NLinePath(SIZE, 2 * SIZE, 0, 2 * SIZE)); shape.UpdateModelBounds(); if (shape.Ports == null) { shape.CreateShapeElements(ShapeElementsMask.Ports); } port = new NDynamicPort(shape.UniqueId, LEFT, DynamicPortGlueMode.GlueToContour); port.Type = PortType.InwardAndOutward; shape.Ports.AddChild(port); port = new NDynamicPort(shape.UniqueId, TOP, DynamicPortGlueMode.GlueToContour); port.Type = PortType.InwardAndOutward; shape.Ports.AddChild(port); port = new NDynamicPort(shape.UniqueId, RIGHT, DynamicPortGlueMode.GlueToContour); port.Type = PortType.InwardAndOutward; shape.Ports.AddChild(port); port = new NDynamicPort(shape.UniqueId, BOTTOM, DynamicPortGlueMode.GlueToContour); port.Type = PortType.InwardAndOutward; shape.Ports.AddChild(port); SetProtections(shape); return(shape); }
public void SetFloatingPointFormat(NStyle ff) { if (ff == NStyle.Fixed) { format = fixedpt; } else { format = scientific; } }
/// <summary> /// Creates the zoom rect /// </summary> /// <remarks> /// This implementation will currently create a zoom rectangle and add it to the preview layer /// </remarks> protected virtual void CreateZoomRect() { // create the zoom rect m_ZoomRect = new NRectanglePath(); NStyle.SetFillStyle(m_ZoomRect, new NColorFillStyle(Color.FromArgb(0, 0, 0, 0))); NStyle.SetStrokeStyle(m_ZoomRect, new NStrokeStyle(1, Color.Black, LinePattern.Dash)); View.PreviewLayer.AddChild(m_ZoomRect); // start dragging View.OnDraggingStarted(); }
public void InitDocument(NDrawingDocument document, NDataGrouping dataGrouping) { // Configure the drawing document document.Layers.RemoveAllChildren(); document.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); document.RoutingManager.Enabled = false; document.BridgeManager.Enabled = false; document.Bounds = new NRectangleF(0, 0, 5000, 5000); document.BackgroundStyle.FillStyle = new NColorFillStyle(Color.LightBlue); // Add a style sheet NStyleSheet styleSheet = new NStyleSheet(WhiteTextStyleSheetName); NTextStyle textStyle = (NTextStyle)document.ComposeTextStyle().Clone(); textStyle.FillStyle = new NColorFillStyle(KnownArgbColorValue.White); NStyle.SetTextStyle(styleSheet, textStyle); document.StyleSheets.AddChild(styleSheet); // Create a map importer NEsriMapImporter mapImporter = new NEsriMapImporter(); mapImporter.MapBounds = NMapBounds.World; // Add a shapefile NEsriShapefile countries = new NEsriShapefile(HttpContext.Current.Server.MapPath(CountriesShapefileName)); countries.NameColumn = "NAME"; countries.TextColumn = "NAME"; mapImporter.AddLayer(countries); // Read the map data mapImporter.Read(); // Create a fill rule NMapFillRuleRange fillRule = new NMapFillRuleRange("POP_1994", Color.White, Color.Black, 12); fillRule.DataGrouping = dataGrouping; countries.FillRule = fillRule; // Associate a shape created listener and import the map data mapImporter.ShapeCreatedListener = new NCustomShapeCreatedListener(); mapImporter.Import(document, document.Bounds); // Generate a legend NMapLegendRange mapLegend = (NMapLegendRange)mapImporter.GetLegend(fillRule); mapLegend.Title = "Population (thousands people)"; mapLegend.RangeFormatString = "{0:#,###,##0,} - {1:#,###,##0,}"; mapLegend.LastFormatString = "more than {0:#,###,##0,}"; NMapLegendRenderPage.MapLegend = mapLegend; document.SizeToContent(); }
public override bool OnPolygonCreated(NDiagramElement element, NMapFeature mapFeature) { NShape shape = element as NShape; if (shape != null) { NInteractivityStyle iStyle = new NInteractivityStyle(true, null, mapFeature.GetAttributeValue(m_sTooltipColumnName).ToString()); NStyle.SetInteractivityStyle(shape, iStyle); } return(base.OnPolygonCreated(element, mapFeature)); }
private void CreateStyleSheets(NDrawingDocument document) { // Create the zoomed city style sheet NStyleSheet zoomedCity = new NStyleSheet(); zoomedCity.Name = "ZoomedCity"; NTextStyle textStyle = (NTextStyle)document.ComposeTextStyle().Clone(); textStyle.FontStyle = new NFontStyle(textStyle.FontStyle.Name, textStyle.FontStyle.EmSize, FontStyle.Bold); NStyle.SetTextStyle(zoomedCity, textStyle); NStyle.SetFillStyle(zoomedCity, new NColorFillStyle(Color.Red)); document.StyleSheets.AddChild(zoomedCity); }
private NMaster CreateGeneralizationMaster() { NStep3Connector c = new NStep3Connector(new NPointF(0, 0), new NPointF(100, 50), true); c.Name = "UML Generalization"; NStrokeStyle strokeStyle = (NStrokeStyle)document.ComposeStrokeStyle().Clone(); NArrowheadStyle arrowheadStyle = new NArrowheadStyle(ArrowheadShape.Arrow, string.Empty, ArrowSize, ConFillStyle, strokeStyle); NStyle.SetStartArrowheadStyle(c, arrowheadStyle); return(new NMaster(c, NGraphicsUnit.Pixel, c.Name, "Drag me on the drawing")); }
private void CreateScene(NDrawingDocument document) { // Initialize the default document style document.BackgroundStyle.FrameStyle.Visible = false; document.Style.StartArrowheadStyle.Shape = ArrowheadShape.None; document.Style.EndArrowheadStyle.Shape = ArrowheadShape.None; document.Style.FillStyle = new NGradientFillStyle(GradientStyle.DiagonalUp, GradientVariant.Variant1, new NArgbColor(155, 184, 209), new NArgbColor(83, 138, 179)); NDrawingDocumentHelper helper = new NDrawingDocumentHelper(document); // Create the shapes NShape vision = helper.CreateBasicShape(BasicShapes.Rectangle, new NRectangleF(0, 0, 100, 50), "Nevron Vision", String.Empty); NInteractivityStyle iStyle = new NInteractivityStyle(); iStyle.UrlLink = new NUrlLinkAttribute("http://www.nevron.com", true); NStyle.SetInteractivityStyle(vision, iStyle); NShape chart = helper.CreateBasicShape(BasicShapes.Rectangle, new NRectangleF(0, 0, 100, 50), "Nevron Chart", String.Empty); iStyle = new NInteractivityStyle(); iStyle.UrlLink = new NUrlLinkAttribute("http://nevron.com/Products.ChartFor.NET.Overview.aspx", true); NStyle.SetInteractivityStyle(chart, iStyle); NShape diagram = helper.CreateBasicShape(BasicShapes.Rectangle, new NRectangleF(0, 0, 100, 50), "Nevron Diagram", String.Empty); iStyle = new NInteractivityStyle(); iStyle.UrlLink = new NUrlLinkAttribute("http://nevron.com/Products.DiagramFor.NET.Overview.aspx", true); NStyle.SetInteractivityStyle(diagram, iStyle); NShape ui = helper.CreateBasicShape(BasicShapes.Rectangle, new NRectangleF(0, 0, 100, 50), "Nevron User Interface", String.Empty); iStyle = new NInteractivityStyle(); iStyle.UrlLink = new NUrlLinkAttribute("http://nevron.com/Products.UserInterfaceFor.NET.Overview.aspx", true); NStyle.SetInteractivityStyle(ui, iStyle); // Create the connectors Connect(vision, chart); Connect(vision, diagram); Connect(vision, ui); // Layout the shapes NLayeredGraphLayout layout = new NLayeredGraphLayout(); layout.Direction = LayoutDirection.LeftToRight; NNodeList shapes = document.ActiveLayer.Children(null); layout.Layout(shapes, new NDrawingLayoutContext(document)); }
/// <summary> /// Shows the text style edtior for the specified styleable node /// </summary> /// <param name="styleable"></param> protected void ShowTextStyleEditor(INStyleable styleable) { if (styleable == null) { return; } NTextStyle textStyle = styleable.ComposeTextStyle(); NTextStyle newTextStyle = null; if (NTextStyleTypeEditor.Edit(textStyle, textStyle != NStyle.GetTextStyle(styleable), out newTextStyle)) { NStyle.SetTextStyle(styleable, newTextStyle); document.SmartRefreshAllViews(); } }
/// <summary> /// Shows the bridge style edtior for the specified styleable node /// </summary> /// <param name="styleable"></param> protected void ShowBridgeStyleEditor(INStyleable styleable) { if (styleable == null) { return; } NBridgeStyle bridgeStyle = styleable.ComposeBridgeStyle(); NBridgeStyle newBridgeStyle = null; if (NBridgeStyleTypeEditor.Edit(bridgeStyle, out newBridgeStyle, bridgeStyle != NStyle.GetBridgeStyle(styleable))) { NStyle.SetBridgeStyle(styleable, newBridgeStyle); document.RefreshAllViews(); } }
/// <summary> /// Shows the shadow style editor for the specified styleable node /// </summary> /// <param name="styleable"></param> protected void ShowShadowStyleEditor(INStyleable styleable) { if (styleable == null) { return; } NShadowStyle shadowStyle = styleable.ComposeShadowStyle(); NShadowStyle newShadowStyle = null; if (NShadowStyleTypeEditor.Edit(shadowStyle, out newShadowStyle)) { NStyle.SetShadowStyle(styleable, newShadowStyle); document.RefreshAllViews(); } }
/// <summary> /// Shows the fill style editor for the specified styleable node /// </summary> /// <param name="styleable"></param> protected void ShowFillStyleEditor(INStyleable styleable) { if (styleable == null) { return; } NFillStyle fillStyle = styleable.ComposeFillStyle(); NFillStyle newFillStyle = null; if (NFillStyleTypeEditor.Edit(fillStyle, out newFillStyle)) { NStyle.SetFillStyle(styleable, newFillStyle); document.RefreshAllViews(); } }
private NMaster CreateCompositionMaster() { NStep3Connector c = new NStep3Connector(new NPointF(0, 0), new NPointF(100, 50), true); c.Name = "UML Composition"; NStrokeStyle strokeStyle = (NStrokeStyle)document.ComposeStrokeStyle().Clone(); NArrowheadStyle arrowheadStyle = new NArrowheadStyle(ArrowheadShape.Losangle, string.Empty, LosangleSize, new NColorFillStyle(Color.Silver), (NStrokeStyle)strokeStyle.Clone()); NStyle.SetStartArrowheadStyle(c, arrowheadStyle); arrowheadStyle = new NArrowheadStyle(ArrowheadShape.OpenedArrow, string.Empty, ArrowSize, ConFillStyle, (NStrokeStyle)strokeStyle.Clone()); NStyle.SetEndArrowheadStyle(c, arrowheadStyle); return(new NMaster(c, NGraphicsUnit.Pixel, c.Name, "Drag me on the drawing")); }
/// <summary> /// Shows the end arrowhead style editor for the specified styleable node /// </summary> /// <param name="styleable"></param> protected void ShowEndArrowheadStyleEditor(INStyleable styleable) { if (styleable == null) { return; } NArrowheadStyle arrowheadStyle = styleable.ComposeEndArrowheadStyle(); NArrowheadStyle newArrowheadStyle = null; if (NArrowheadStyleTypeEditor.Edit(arrowheadStyle, out newArrowheadStyle, false, arrowheadStyle != NStyle.GetEndArrowheadStyle(styleable))) { NStyle.SetEndArrowheadStyle(styleable, newArrowheadStyle); document.RefreshAllViews(); } }
private NMaster CreateAssociationMaster() { NStep3Connector c = new NStep3Connector(new NPointF(0, 0), new NPointF(100, 50), true); c.Name = "UML Association"; NStrokeStyle strokeStyle = (NStrokeStyle)document.ComposeStrokeStyle().Clone(); NArrowheadStyle arrowheadStyle = new NArrowheadStyle(ArrowheadShape.OpenedArrow, string.Empty, ArrowSize, ConFillStyle, (NStrokeStyle)strokeStyle.Clone()); NStyle.SetEndArrowheadStyle(c, arrowheadStyle); strokeStyle.Pattern = LinePattern.Dash; NStyle.SetStrokeStyle(c, strokeStyle); return(new NMaster(c, NGraphicsUnit.Pixel, c.Name, "Drag me on the drawing")); }
protected NCompositeShape CreateLegendItem(NRectangleF bounds, string str, NFillStyle fillStyle) { NCompositeShape item = new NCompositeShape(); NRectanglePath rect = new NRectanglePath(0, 0, 2, 2); NStyle.SetFillStyle(rect, (fillStyle.Clone() as NFillStyle)); item.Primitives.AddChild(rect); NTextPrimitive text = new NTextPrimitive(str, new NRectangleF(2, 0, 4, 2)); item.Primitives.AddChild(text); item.UpdateModelBounds(); item.Bounds = bounds; return(item); }
public void InitDocument(NDrawingDocument document) { // Set up visual formatting document.BackgroundStyle.FrameStyle.Visible = false; document.BackgroundStyle.FillStyle = new NColorFillStyle(Color.LightBlue); document.GraphicsSettings.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; // Create style sheets NStyleSheet clickedCounty = new NStyleSheet("ClickedCounty"); NStyle.SetFillStyle(clickedCounty, new NColorFillStyle(KnownArgbColorValue.Red)); NStyle.SetTextStyle(clickedCounty, new NTextStyle(document.ComposeTextStyle().FontStyle, Color.White)); document.StyleSheets.AddChild(clickedCounty); // Load the map of the USA LoadUsaMap(document); }
private void InitDocument() { document.Style.StrokeStyle = new NStrokeStyle(0, Color.Empty); // Add some gradient fill style sheets NStyleSheet styleSheet = new NStyleSheet("Style1"); NStyle.SetFillStyle(styleSheet, new NColorFillStyle(Color.Red)); document.StyleSheets.AddChild(styleSheet); styleSheet = new NStyleSheet("Style2"); NStyle.SetFillStyle(styleSheet, new NColorFillStyle(Color.Green)); document.StyleSheets.AddChild(styleSheet); styleSheet = new NStyleSheet("Style3"); NStyle.SetFillStyle(styleSheet, new NColorFillStyle(Color.Blue)); document.StyleSheets.AddChild(styleSheet); }
public override bool OnPolygonCreated(NDiagramElement element, NMapFeature mapFeature) { NShape shape = element as NShape; if (shape == null) { return(true); } string name = mapFeature.GetAttributeValue("CNTRY_NAME").ToString(); int population = Int32.Parse(mapFeature.GetAttributeValue("POP_CNTRY").ToString()); NInteractivityStyle interactivityStyle = new NInteractivityStyle(String.Format("{0}'{1} population: {2:N0}", name, name.EndsWith("s") ? String.Empty : "s", population)); NStyle.SetInteractivityStyle(shape, interactivityStyle); return(true); }
private void InitDocument(NDrawingDocument document) { // Set up visual formatting document.BackgroundStyle.FrameStyle.Visible = false; document.Style.TextStyle.FontStyle = new NFontStyle(document.Style.TextStyle.FontStyle.Name, 14); // Create the stylesheets int i = 0; int count = GradientSchemes.Length; for (i = 0; i < count; i++) { AdvancedGradientScheme scheme = GradientSchemes[i]; NStyleSheet styleSheet = new NStyleSheet(scheme.ToString()); NAdvancedGradientFillStyle fill = new NAdvancedGradientFillStyle(scheme, 4); if (scheme.Equals(AdvancedGradientScheme.Green)) { // Make the green color dark ((NAdvancedGradientPoint)fill.Points[0]).Color = Color.FromArgb(0, 128, 0); } NStyle.SetFillStyle(styleSheet, fill); document.StyleSheets.AddChild(styleSheet); NAdvancedGradientFillStyle highlightedFill = (NAdvancedGradientFillStyle)fill.Clone(); ((NAdvancedGradientPoint)highlightedFill.Points[0]).Color = ControlPaint.LightLight(((NAdvancedGradientPoint)fill.Points[0]).Color); NStyleSheet highlightedStyleSheet = new NStyleSheet(styleSheet.Name + HighlightedSuffix); NStyle.SetFillStyle(highlightedStyleSheet, highlightedFill); document.StyleSheets.AddChild(highlightedStyleSheet); } // Create the board and info shapes NClickomaniaGame game = new NClickomaniaGame(); CreateBoardShape(document, game); CreateInfoShape(document, game); game.BoardShape.Location = new NPointF(game.InfoShape.Bounds.Right + game.InfoShape.Width / 2, game.BoardShape.Location.Y); // Resize the document to fit all shapes document.SizeToContent(); game.InfoShape.Location = new NPointF(game.InfoShape.Location.X, game.BoardShape.Location.Y); document.Tag = game; }
private void CreateMechanicalEngineeringDocument() { // create the key shape NCompositeShape key = new NCompositeShape(); NRectanglePath keyRect = new NRectanglePath(new NRectangleF(12.5f, 30, 5f, 50)); key.Primitives.AddChild(keyRect); NEllipsePath keyCircle = new NEllipsePath(new NRectangleF(0, 0, 30, 30)); key.Primitives.AddChild(keyCircle); NEllipsePath keyHole = new NEllipsePath(new NRectangleF(13f, 2f, 4f, 4f)); NStyle.SetFillStyle(keyHole, new NColorFillStyle(Color.White)); NStyle.SetStrokeStyle(keyHole, new NStrokeStyle(0, Color.Black)); key.Primitives.AddChild(keyHole); key.UpdateModelBounds(); key.Style.FillStyle = new NColorFillStyle(Color.DarkGray); key.Style.StrokeStyle = new NStrokeStyle(0, Color.Black); document.ActiveLayer.AddChild(key); // create the octagram NBasicShapesFactory factory = new NBasicShapesFactory(document); NShape octagram = factory.CreateShape((int)BasicShapes.Octagram); octagram.Bounds = new NRectangleF(40, 0, 40, 40); octagram.Style.FillStyle = new NColorFillStyle(Color.DarkGray); octagram.Style.StrokeStyle = new NStrokeStyle(0, Color.Black); document.ActiveLayer.AddChild(octagram); // update the drawing bounds to size to content with some margins document.AutoBoundsMinSize = new NSizeF(1, 1); document.AutoBoundsPadding = new Nevron.Diagram.NMargins(5f); document.AutoBoundsMode = AutoBoundsMode.AutoSizeToContent; }
private void InitDocument() { // change the document style NStyle style = document.Style; style.FillStyle = new NColorFillStyle(Color.FromArgb(50, 0x66, 0x66, 0)); style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(0x11, 0x11, 0)); style.TextStyle.FontStyle = new NFontStyle(new Font("Arial", 9)); style.TextStyle.FillStyle = new NColorFillStyle(Color.FromArgb(0x2a, 0x20, 0x00)); style.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Left; style.StartArrowheadStyle.StrokeStyle = document.Style.StrokeStyle.Clone() as NStrokeStyle; style.EndArrowheadStyle.StrokeStyle = document.Style.StrokeStyle.Clone() as NStrokeStyle; // create the shapes CreateCenterShape(); CreateShapeWithDynamicPort(); CreateShapeWithBoundsPort(); CreateShapeWithRotatedBoundsPort(); CreateShapeWithPointPort(); CreateShapeWithLogicalLinePort(); CreateArrowShapeWithLogicalLinePort(); }
private void InitDocument() { // change the document style NStyle style = document.Style; style.FillStyle = new NColorFillStyle(Color.FromArgb(50, 0x66, 0x66, 0)); style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(0x11, 0x11, 0)); style.TextStyle.FontStyle = new NFontStyle(new Font("Arial", 9)); style.TextStyle.FillStyle = new NColorFillStyle(Color.FromArgb(0x2a, 0x20, 0x00)); style.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Left; style.StartArrowheadStyle.StrokeStyle = document.Style.StrokeStyle.Clone() as NStrokeStyle; style.EndArrowheadStyle.StrokeStyle = document.Style.StrokeStyle.Clone() as NStrokeStyle; // create the shapes CreateMoveMeShape(); CreateShapeWithAutoSideDirection(); CreateShapeWithAutoCenterDirection(); CreateShapeWithCustomDirection(); CreateShapeWithAutoNextPort(); CreateShapeWithAutoPrevPort(); CreateShapeWithAutoLinePort(); }
private void InitDocument() { // Create the stylesheets int i = 0, count = COLORS.Length; cells = new int[count]; for (i = 0; i < count; i++) { NStyleSheet styleSheet = new NStyleSheet(COLORS[i].ToString()); NStyle.SetFillStyle(styleSheet, new NAdvancedGradientFillStyle(COLORS[i], 4)); document.StyleSheets.AddChild(styleSheet); cells[i] = 0; } // Create the table score = 0; table = CreateTableShape(); info = CreateInfoShape(); table.Location = new NPointF(info.Bounds.Right + info.Width / 2, table.Location.Y); // Resize the document to fit all shapes document.SizeToContent(); }
public void SetFloatingPointFormat(NStyle ff) { if (ff == NStyle.Fixed) format = fixedpt; else format = scientific; }
protected void InitDocument() { NDrawingDocument document = NDrawingView1.Document; // Import the Visio stencil NLibraryDocument libDocument = new NLibraryDocument(); NVisioImporter importer = new NVisioImporter(libDocument); importer.Import(Server.MapPath(@"~\Examples\Import\Computers.vsx")); // Set drawing preferences document.GraphicsSettings.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; document.GraphicsSettings.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; document.GraphicsSettings.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality; document.BackgroundStyle.FrameStyle.Visible = false; // Determine the shape size int maxOrdinal = 0; int scale = 1; switch (shapeSizeDropDownList.SelectedValue) { case "Small": scale = 1; maxOrdinal = 5; break; case "Medium": scale = 2; maxOrdinal = 3; break; case "Large": scale = 4; maxOrdinal = 1; break; default: throw new NotImplementedException(shapeSizeDropDownList.SelectedValue); } // Determine the shapes size and layout options NNodeList masters = libDocument.Children(NFilters.TypeNMaster); for (int i = 0, count = masters.Count; i < count; i++) { NMaster master = (NMaster)masters[i]; NNodeList shapes = master.CreateInstance(document, new NPointF(0, 0)); NShape shape = (NShape)shapes[0]; shape.Width *= scale; shape.Height *= scale; NStyle.SetInteractivityStyle(shape, new NInteractivityStyle(master.Name)); } // Layout the shapes in the active layer using a table layout NTableLayout layout = new NTableLayout(); layout.Direction = LayoutDirection.LeftToRight; layout.ConstrainMode = CellConstrainMode.Ordinal; layout.MaxOrdinal = maxOrdinal; layout.VerticalSpacing = 20; layout.HorizontalSpacing = 20; layout.HorizontalContentPlacement = ContentPlacement.Center; layout.VerticalContentPlacement = ContentPlacement.Center; layout.Layout(document.ActiveLayer.Children(null), new NDrawingLayoutContext(document)); // Resize document to fit all shapes document.SizeToContent(); }
private void CreateAnimatedGrid(int rows, int columns, float cellFadeDuration) { NDrawingDocument document = DrawingView.Document; // Create the grid layer NLayer grid = new NLayer(); grid.Name = "grid"; document.Layers.AddChild(grid); // Create the cells style sheet NStyleSheet style = new NStyleSheet("gridCell"); NStyle.SetFillStyle(style, new NColorFillStyle(KnownArgbColorValue.White)); NStyle.SetStrokeStyle(style, new NStrokeStyle(1, KnownArgbColorValue.Black)); document.StyleSheets.AddChild(style); int i, j, count; float x, y, time = 0; float cellWidth = document.Width / rows; float cellHeight = document.Height / columns; NFadeAnimation fade; NRectangleShape rect; List <NRectangleShape> cells = new List <NRectangleShape>(); // Create the shapes for (i = 0, y = 0; i < rows; i++, y += cellHeight) { for (j = 0, x = 0; j < columns; j++, x += cellWidth) { rect = new NRectangleShape(x, y, cellWidth, cellHeight); cells.Add(rect); grid.AddChild(rect); rect.StyleSheetName = style.Name; } } // Create the fade animations count = cells.Count; Random random = new Random(); int counter = 1; while (count > 0) { i = random.Next(count); rect = cells[i]; rect.Style.AnimationsStyle = new NAnimationsStyle(); if (time > 0) { fade = new NFadeAnimation(0, time); fade.StartAlpha = 1; fade.EndAlpha = 1; rect.Style.AnimationsStyle.AddAnimation(fade); } fade = new NFadeAnimation(time, cellFadeDuration); fade.StartAlpha = 1; fade.EndAlpha = 0; rect.Style.AnimationsStyle.AddAnimation(fade); if (counter == 3) { // Show 3 cells at a time time += cellFadeDuration; counter = 1; } else { counter++; } cells.RemoveAt(i); count--; } }