コード例 #1
0
        private void DecorateGaugeAxis(NRadialGaugePanel panel, NRange1DD range, Color colorLight, Color colorDark)
        {
            NGaugeAxis axis = (NGaugeAxis)panel.Axes[0];
            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            // create a range indicator
            NRangeIndicator rangeIndicator = new NRangeIndicator();

            rangeIndicator.OriginMode = OriginMode.Custom;
            rangeIndicator.Value      = range.Begin;
            rangeIndicator.Origin     = range.End;
            rangeIndicator.BeginWidth = new NLength(10);
            rangeIndicator.EndWidth   = new NLength(10);

            rangeIndicator.FillStyle         = new NColorFillStyle(Color.FromArgb(100, colorLight));
            rangeIndicator.StrokeStyle.Color = colorLight;
            panel.Indicators.Add(rangeIndicator);

            // create a scale section
            NScaleSectionStyle scaleSection = new NScaleSectionStyle();

            scaleSection.Range = range;
            scaleSection.MajorTickStrokeStyle = new NStrokeStyle(colorLight);
            scaleSection.MinorTickStrokeStyle = new NStrokeStyle(1, colorLight, LinePattern.Dot, 0, 2);

            NTextStyle labelStyle = new NTextStyle();

            labelStyle.FillStyle        = new NGradientFillStyle(colorLight, colorDark);
            labelStyle.FontStyle        = new NFontStyle("Arial", 10, FontStyle.Bold);
            scaleSection.LabelTextStyle = labelStyle;

            scale.Sections.Add(scaleSection);
        }
コード例 #2
0
        protected void DecorateGaugeAxis(NRadialGaugePanel panel, NRange1DD range, Color colorLight, Color colorDark)
        {
            NGaugeAxis axis = (NGaugeAxis)panel.Axes[0];
            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            NRangeIndicator rangeIndicator = new NRangeIndicator();

            rangeIndicator.OriginMode      = OriginMode.Custom;
            rangeIndicator.OffsetFromScale = new NLength(10);
            rangeIndicator.Value           = range.Begin;
            rangeIndicator.Origin          = range.End;

            rangeIndicator.FillStyle         = new NColorFillStyle(Color.FromArgb(30, colorLight));
            rangeIndicator.StrokeStyle.Width = new NLength(0);
            panel.Indicators.Add(rangeIndicator);

            NScaleSectionStyle scaleSection = new NScaleSectionStyle();

            scaleSection.Range = range;
            scaleSection.MajorTickFillStyle = new NColorFillStyle(colorLight);
            scaleSection.MinorTickFillStyle = new NColorFillStyle(colorLight);

            NTextStyle labelStyle = new NTextStyle();

            labelStyle.FillStyle        = new NColorFillStyle(colorDark);
            labelStyle.FontStyle.Style  = FontStyle.Bold;
            labelStyle.FontStyle.EmSize = new NLength(6);
            scaleSection.LabelTextStyle = labelStyle;

            scale.Sections.Add(scaleSection);
        }
コード例 #3
0
        public NFloorPlanDiagramUC(NMainForm form)
            : base(form)
        {
            initializingControls = true;

            InitializeComponent();

            //	styles
            txMain           = new NTextStyle();
            txMain.FontStyle = new NFontStyle("Arial", 9);
            txMain.BackplaneStyle.Visible = false;
            txMain.Offset = new NPointL(0, 0);

            txLine           = new NTextStyle();
            txLine.FontStyle = new NFontStyle("Arial", 9);
            txLine.BackplaneStyle.Visible   = true;
            txLine.BackplaneStyle.FillStyle = new NColorFillStyle(Color.FromArgb(128, Color.White));
            txLine.BackplaneStyle.StandardFrameStyle.Visible = false;

            txLineSmall           = new NTextStyle();
            txLineSmall.FontStyle = new NFontStyle("Arial", 5);
            txLineSmall.BackplaneStyle.Visible   = true;
            txLineSmall.BackplaneStyle.FillStyle = new NColorFillStyle(Color.FromArgb(128, Color.White));
            txLineSmall.BackplaneStyle.StandardFrameStyle.Visible = false;

            sstOdd  = new NStrokeStyle(1, Color.Black);
            sstEven = new NStrokeStyle(1, Color.LightGray);

            initializingControls = false;
        }
コード例 #4
0
        private void CreateArchitecturalDocument()
        {
            // set global document styles
            document.Style.TextStyle = new NTextStyle(new Font("Arial", 8.25f));
            document.Style.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Center;
            document.Style.TextStyle.StringFormatStyle.VertAlign = VertAlign.Center;

            // create the rim rect
            NRectangleShape rimRect = new NRectangleShape(new NRectangleF(0, 0, 5, 7));

            rimRect.Style.FillStyle = new NColorFillStyle(Color.FromArgb(0, Color.White));
            document.ActiveLayer.AddChild(rimRect);

            // create the room rects
            NRectangleShape roomRect1 = new NRectangleShape(new NRectangleF(0, 0, 2, 3));

            roomRect1.Text = "Room 1";
            document.ActiveLayer.AddChild(roomRect1);

            NRectangleShape roomRect2 = new NRectangleShape(new NRectangleF(3, 0, 2, 3));

            roomRect2.Text = "Room 2";
            document.ActiveLayer.AddChild(roomRect2);

            NRectangleShape roomRect3 = new NRectangleShape(new NRectangleF(0, 4, 2, 3));

            roomRect3.Text = "Room 3";
            document.ActiveLayer.AddChild(roomRect3);

            // create the stairs case
            NCompositeShape stairCase = new NCompositeShape();

            float stepXSize = 0.7f;
            float stepYSize = 0.25f;

            for (int i = 0; i < 9; i++)
            {
                NRectanglePath step = new NRectanglePath(0, stepYSize * i, stepXSize, stepYSize);
                stairCase.Primitives.AddChild(step);
            }

            stairCase.UpdateModelBounds();
            stairCase.Bounds = new NRectangleF(4, 4, 1, 3);

            stairCase.Text = "Stairs";
            NTextStyle textStyle = (document.Style.TextStyle.Clone() as NTextStyle);

            textStyle.Orientation     = 90;
            stairCase.Style.TextStyle = textStyle;

            document.ActiveLayer.AddChild(stairCase);

            // update the drawing bounds to size to content with some margins
            document.AutoBoundsMinSize = new NSizeF(1, 1);
            document.AutoBoundsPadding = new Nevron.Diagram.NMargins(0.5f);
            document.AutoBoundsMode    = AutoBoundsMode.AutoSizeToContent;
        }
コード例 #5
0
        private void ThirdRowTextStyleButton_Click(object sender, EventArgs e)
        {
            NValueTimelineScaleConfigurator valueTimelineScale = m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NValueTimelineScaleConfigurator;
            NTextStyle result = null;

            if (NTextStyleTypeEditor.Edit(valueTimelineScale.ThirdRow.LabelStyle.TextStyle, out result))
            {
                valueTimelineScale.ThirdRow.LabelStyle.TextStyle = result;
                nChartControl1.Refresh();
            }
        }
コード例 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="gauge"></param>
        private void InitSections(NGauge gauge)
        {
            gauge.Axes.Clear();
            NGaugeAxis axis = new NGaugeAxis();

            gauge.Axes.Add(axis);

            axis.Anchor = new NDockGaugeAxisAnchor(ENGaugeAxisDockZone.Top);

            NStandardScale scale = (NStandardScale)axis.Scale;

            // init text style for regular labels
            scale.Labels.Style.TextStyle.Fill = new NColorFill(NColor.White);
            scale.Labels.Style.TextStyle.Font = new NFont("Arimo", 10, ENFontStyle.Bold);

            // init ticks
            scale.MajorGridLines.Visible = true;
            scale.MinTickDistance        = 25;
            scale.MinorTickCount         = 1;
            scale.SetPredefinedScale(ENPredefinedScaleStyle.Scientific);

            // create sections
            NScaleSection blueSection = new NScaleSection();

            blueSection.Range           = new NRange(0, 20);
            blueSection.RangeFill       = new NColorFill(NColor.FromColor(NColor.Blue, 0.5f));
            blueSection.MajorGridStroke = new NStroke(NColor.Blue);
            blueSection.MajorTickStroke = new NStroke(NColor.DarkBlue);
            blueSection.MinorTickStroke = new NStroke(1, NColor.Blue, ENDashStyle.Dot);

            NTextStyle labelStyle = new NTextStyle();

            labelStyle.Fill            = new NColorFill(NColor.Blue);
            labelStyle.Font            = new NFont("Arimo", 10, ENFontStyle.Bold);
            blueSection.LabelTextStyle = labelStyle;

            scale.Sections.Add(blueSection);

            NScaleSection redSection = new NScaleSection();

            redSection.Range = new NRange(80, 100);

            redSection.RangeFill       = new NColorFill(NColor.FromColor(NColor.Red, 0.5f));
            redSection.MajorGridStroke = new NStroke(NColor.Red);
            redSection.MajorTickStroke = new NStroke(NColor.DarkRed);
            redSection.MinorTickStroke = new NStroke(1, NColor.Red, ENDashStyle.Dot);

            labelStyle                = new NTextStyle();
            labelStyle.Fill           = new NColorFill(NColor.Red);
            labelStyle.Font           = new NFont("Arimo", 10.0, ENFontStyle.Bold);
            redSection.LabelTextStyle = labelStyle;

            scale.Sections.Add(redSection);
        }
コード例 #7
0
            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();
            }
コード例 #8
0
        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);
        }
コード例 #9
0
        private void InitSections(NGaugePanel gaugePanel)
        {
            NGaugeAxis axis = (NGaugeAxis)gaugePanel.Axes[0];
            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            // init text style for regular labels
            scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White);
            scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 10, FontStyle.Bold);

            // init ticks
            scale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            scale.MinTickDistance = new NLength(20);
            scale.MinorTickCount  = 1;
            scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Scientific);

            // create sections
            NScaleSectionStyle blueSection = new NScaleSectionStyle();

            blueSection.Range = new NRange1DD(0, 20);
            blueSection.SetShowAtWall(ChartWallType.Back, true);
            blueSection.RangeFillStyle       = new NColorFillStyle(Color.FromArgb(50, Color.Blue));
            blueSection.MajorGridStrokeStyle = new NStrokeStyle(Color.Blue);
            blueSection.MajorTickStrokeStyle = new NStrokeStyle(Color.DarkBlue);
            blueSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Blue, LinePattern.Dot, 0, 2);

            NTextStyle labelStyle = new NTextStyle();

            labelStyle.FillStyle       = new NColorFillStyle(Color.Blue);
            labelStyle.FontStyle       = new NFontStyle("Arial", 10, FontStyle.Bold);
            blueSection.LabelTextStyle = labelStyle;

            scale.Sections.Add(blueSection);

            NScaleSectionStyle redSection = new NScaleSectionStyle();

            redSection.Range = new NRange1DD(80, 100);

            redSection.SetShowAtWall(ChartWallType.Back, true);
            redSection.RangeFillStyle       = new NColorFillStyle(Color.FromArgb(50, Color.Red));
            redSection.MajorGridStrokeStyle = new NStrokeStyle(Color.Red);
            redSection.MajorTickStrokeStyle = new NStrokeStyle(Color.DarkRed);
            redSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Red, LinePattern.Dot, 0, 2);

            labelStyle                = new NTextStyle();
            labelStyle.FillStyle      = new NColorFillStyle(Color.Red);
            labelStyle.FontStyle      = new NFontStyle("Arial", 10, FontStyle.Bold);
            redSection.LabelTextStyle = labelStyle;

            scale.Sections.Add(redSection);
        }
コード例 #10
0
        private void SetTitle()
        {
            NStandardScaleConfigurator scaleConfiguratorY = (NStandardScaleConfigurator)nChart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;
            NStandardScaleConfigurator scaleConfiguratorX = (NStandardScaleConfigurator)nChart.Axis(StandardAxis.PrimaryX).ScaleConfigurator;

            NTextStyle textStyleResultY = new NTextStyle(new NFontStyle(YAxisFontDropDownList.SelectedValue));
            NTextStyle textStyleResultX = new NTextStyle(new NFontStyle(XAxisFontDropDownList.SelectedValue));

            scaleConfiguratorY.Title.TextStyle = textStyleResultY;
            scaleConfiguratorX.Title.TextStyle = textStyleResultX;

            switch (YAlignmentDropDownList.SelectedIndex)
            {
            case 0:
                scaleConfiguratorY.Title.ContentAlignment = ContentAlignment.MiddleRight;
                scaleConfiguratorY.Title.RulerAlignment   = HorzAlign.Right;
                break;

            case 1:
                scaleConfiguratorY.Title.ContentAlignment = ContentAlignment.MiddleCenter;
                scaleConfiguratorY.Title.RulerAlignment   = HorzAlign.Center;
                break;

            case 2:
                scaleConfiguratorY.Title.ContentAlignment = ContentAlignment.MiddleLeft;
                scaleConfiguratorY.Title.RulerAlignment   = HorzAlign.Left;
                break;
            }

            switch (XAlignmentDropDownList.SelectedIndex)
            {
            case 0:
                scaleConfiguratorX.Title.ContentAlignment = ContentAlignment.MiddleLeft;
                scaleConfiguratorX.Title.RulerAlignment   = HorzAlign.Left;
                break;

            case 1:
                scaleConfiguratorX.Title.ContentAlignment = ContentAlignment.MiddleCenter;
                scaleConfiguratorX.Title.RulerAlignment   = HorzAlign.Center;
                break;

            case 2:
                scaleConfiguratorX.Title.ContentAlignment = ContentAlignment.MiddleRight;
                scaleConfiguratorX.Title.RulerAlignment   = HorzAlign.Right;
                break;
            }

            scaleConfiguratorY.Title.Offset = new NLength(Convert.ToInt32(YOffsetDropDownList.SelectedValue), NGraphicsUnit.Pixel);
            scaleConfiguratorX.Title.Offset = new NLength(Convert.ToInt32(XOffsetDropDownList.SelectedValue), NGraphicsUnit.Pixel);
        }
コード例 #11
0
        private NScaleSection CreateSection(NColor tickColor, NColor labelColor, NRange range)
        {
            NScaleSection scaleSection = new NScaleSection();

            scaleSection.Range         = range;
            scaleSection.MajorTickFill = new NColorFill(tickColor);

            NTextStyle labelStyle = new NTextStyle();

            labelStyle.Fill             = new NColorFill(labelColor);
            labelStyle.Font             = new NFont("Arimo", 12, ENFontStyle.Bold);
            scaleSection.LabelTextStyle = labelStyle;

            return(scaleSection);
        }
コード例 #12
0
        /// <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();
            }
        }
コード例 #13
0
        private NScaleSectionStyle CreateSection(Color tickColor, Color labelColor, NRange1DD range)
        {
            NScaleSectionStyle scaleSection = new NScaleSectionStyle();

            scaleSection.Range              = range;
            scaleSection.LabelTextStyle     = new NTextStyle(new NFontStyle(), tickColor);
            scaleSection.MajorTickFillStyle = new NColorFillStyle(tickColor);

            NTextStyle labelStyle = new NTextStyle();

            labelStyle.FillStyle        = new NColorFillStyle(labelColor);
            labelStyle.FontStyle        = new NFontStyle("Arial", 10, FontStyle.Bold);
            scaleSection.LabelTextStyle = labelStyle;

            return(scaleSection);
        }
コード例 #14
0
        private void CreateStyleSheets()
        {
            NDrawingDocument document = NDrawingView1.Document;

            // create a stylesheet for the president
            NStyleSheet styleSheet = new NStyleSheet("PRESIDENT");

            styleSheet.Style.FillStyle = new NColorFillStyle(Color.FromArgb(129, 133, 133));
            styleSheet.Style.FillStyle.ImageFiltersStyle.Filters.Add(new NLightingImageFilter());
            document.StyleSheets.AddChild(styleSheet);

            // create a stylesheet for the VPs
            styleSheet = new NStyleSheet("VP");
            styleSheet.Style.FillStyle = new NColorFillStyle(Color.FromArgb(162, 173, 182));
            styleSheet.Style.FillStyle.ImageFiltersStyle.Filters.Add(new NLightingImageFilter());
            document.StyleSheets.AddChild(styleSheet);

            // create a stylesheet for the managers
            styleSheet = new NStyleSheet("MANAGER");
            styleSheet.Style.FillStyle = new NColorFillStyle(Color.FromArgb(251, 203, 156));
            styleSheet.Style.FillStyle.ImageFiltersStyle.Filters.Add(new NLightingImageFilter());
            document.StyleSheets.AddChild(styleSheet);

            // create a stylesheet for the person name labels
            styleSheet = new NStyleSheet("NAME");

            NTextStyle textStyle = document.Style.TextStyle.Clone() as NTextStyle;

            textStyle.FontStyle.InitFromFont(new Font("Arial", 10, FontStyle.Bold));
            textStyle.StringFormatStyle.HorzAlign = HorzAlign.Right;
            textStyle.StringFormatStyle.VertAlign = VertAlign.Bottom;

            styleSheet.Style.TextStyle = textStyle;
            document.StyleSheets.AddChild(styleSheet);

            // create a stylesheet for the person position labels
            styleSheet = new NStyleSheet("POSITION");

            textStyle = document.Style.TextStyle.Clone() as NTextStyle;
            textStyle.FontStyle.InitFromFont(new Font("Arial", 10, FontStyle.Bold));
            textStyle.StringFormatStyle.HorzAlign = HorzAlign.Right;
            textStyle.StringFormatStyle.VertAlign = VertAlign.Center;

            styleSheet.Style.TextStyle = textStyle;
            document.StyleSheets.AddChild(styleSheet);
        }
コード例 #15
0
        private void ConfigureScale(NStandardScaleConfigurator scale, NRange1DD redRange)
        {
            scale.SetPredefinedScaleStyle(PredefinedScaleStyle.PresentationNoStroke);
            scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 9, FontStyle.Bold);
            scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White);
            scale.LabelStyle.Angle             = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0);
            scale.MinorTickCount               = 1;
            scale.RulerStyle.BorderStyle.Width = new NLength(0);
            scale.RulerStyle.FillStyle         = new NColorFillStyle(Color.FromArgb(125, Color.SlateGray));

            NScaleSectionStyle scaleSection = new NScaleSectionStyle();

            scaleSection.Range = redRange;
            scaleSection.MajorTickFillStyle = new NColorFillStyle(Color.Red);
            scaleSection.MinorTickFillStyle = new NColorFillStyle(Color.Red);

            NTextStyle labelStyle = new NTextStyle();

            labelStyle.FillStyle        = new NGradientFillStyle(Color.Red, Color.DarkRed);
            labelStyle.FontStyle        = new NFontStyle("Arial", 9, FontStyle.Bold);
            scaleSection.LabelTextStyle = labelStyle;

            scale.Sections.Add(scaleSection);
        }
コード例 #16
0
        protected void CreateScene()
        {
            // configure title
            NTextShape title = new NTextShape("The Business Company", 0, 0, Document.Width, 60);

            Document.ActiveLayer.AddChild(title);

            NTextStyle textStyle = title.ComposeTextStyle().Clone() as NTextStyle;

            textStyle.FontStyle.InitFromFont(new Font("Arial Black", 22, FontStyle.Bold | FontStyle.Italic));

            // set gradient fill style
            textStyle.FillStyle = new NGradientFillStyle(
                GradientStyle.Horizontal,
                GradientVariant.Variant1,
                Color.FromArgb(241, 100, 34),
                Color.FromArgb(255, 247, 151));

            // add shadow
            textStyle.ShadowStyle = new NShadowStyle(
                ShadowType.GaussianBlur,
                Color.FromArgb(50, 122, 122, 122),
                new Nevron.GraphicsCore.NPointL(5, 5),
                1,
                new NLength(3));

            title.Style.TextStyle = textStyle;

            NPersonalInfo[] personalInfos = NPersonalInfo.CreateCompanyInfo();


            // create an Org chart shape for each person in the Org chart
            NCompositeShape presidentShape = CreateOrgChartShape(personalInfos[0]);

            NCompositeShape vpMarketingShape  = CreateOrgChartShape(personalInfos[1]);
            NCompositeShape vpSalesShape      = CreateOrgChartShape(personalInfos[2]);
            NCompositeShape vpProductionShape = CreateOrgChartShape(personalInfos[3]);

            NCompositeShape mm01Shape = CreateOrgChartShape(personalInfos[4]);
            NCompositeShape mm02Shape = CreateOrgChartShape(personalInfos[5]);

            NCompositeShape sm01Shape = CreateOrgChartShape(personalInfos[6]);
            NCompositeShape sm02Shape = CreateOrgChartShape(personalInfos[7]);

            NCompositeShape pm01Shape = CreateOrgChartShape(personalInfos[8]);
            NCompositeShape pm02Shape = CreateOrgChartShape(personalInfos[9]);

            //	connect the Org chart shapes
            // 1. President to VPs
            NShape ge = null;

            ge = new NStep3Connector(true, 50, 0, true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(presidentShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(vpMarketingShape.Ports.GetChildByName("Top", 0) as NPort);

            ge = new NStep3Connector(true, 50, 0, true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(presidentShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(vpSalesShape.Ports.GetChildByName("Top", 0) as NPort);

            ge = new NStep3Connector(true, 50, 0, true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(presidentShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(vpProductionShape.Ports.GetChildByName("Top", 0) as NPort);

            // 1. VPs to managers
            ge = new NStep2Connector(true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(vpMarketingShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(mm01Shape.Ports.GetChildByName("Left", 0) as NPort);

            ge = new NStep2Connector(true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(vpMarketingShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(mm02Shape.Ports.GetChildByName("Left", 0) as NPort);

            ge = new NStep2Connector(true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(vpSalesShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(sm01Shape.Ports.GetChildByName("Left", 0) as NPort);

            ge = new NStep2Connector(true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(vpSalesShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(sm02Shape.Ports.GetChildByName("Left", 0) as NPort);

            ge = new NStep2Connector(true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(vpProductionShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(pm01Shape.Ports.GetChildByName("Left", 0) as NPort);

            ge = new NStep2Connector(true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(vpProductionShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(pm02Shape.Ports.GetChildByName("Left", 0) as NPort);
        }
コード例 #17
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // begin view init
            nDrawingView.BeginInit();

            // display the document in the view
            nDrawingView.Document = nDrawingDocument;

            // show ports
            nDrawingView.GlobalVisibility.ShowPorts = true;

            // hide the grid
            nDrawingView.Grid.Visible = false;

            // fit the document in the viewport
            nDrawingView.ViewLayout = ViewLayout.Normal;

            // apply padding to the document bounds
            nDrawingView.DocumentPadding = new Nevron.Diagram.NMargins(10);

            // init document
            nDrawingDocument.BeginInit();

            // modify the connectors style sheet
            NStyleSheet styleSheet = (nDrawingDocument.StyleSheets.GetChildByName(NDR.NameConnectorsStyleSheet, -1) as NStyleSheet);

            NTextStyle textStyle = new NTextStyle();

            textStyle.BackplaneStyle.Visible = false;
            textStyle.BackplaneStyle.StandardFrameStyle.InnerBorderWidth = new NLength(0);
            styleSheet.Style.TextStyle = textStyle;

            styleSheet.Style.StrokeStyle = new NStrokeStyle(1, Color.Black);
            styleSheet.Style.StartArrowheadStyle.StrokeStyle = new NStrokeStyle(1, Color.Black);
            styleSheet.Style.EndArrowheadStyle.StrokeStyle   = new NStrokeStyle(1, Color.Black);

            // create a stylesheet for the 2D Shapes
            styleSheet = new NStyleSheet("SHAPE2D");
            styleSheet.Style.FillStyle = new NColorFillStyle(Color.PapayaWhip);
            nDrawingDocument.StyleSheets.AddChild(styleSheet);

            // create a stylesheet for the arrows, which inherits from the connectors stylesheet
            styleSheet = new NStyleSheet("ARROW", NDR.NameConnectorsStyleSheet);

            textStyle = new NTextStyle();
            textStyle.FontStyle.InitFromFont(new Font("Arial", 8));
            styleSheet.Style.TextStyle = textStyle;

            nDrawingDocument.StyleSheets.AddChild(styleSheet);

            // init form fields
            //m_Layout = new NOrthogonalGraphLayout();
            //propertyGrid1.SelectedObject = m_Layout;

            InitDocument();

            // end nDrawingDocument1 init
            nDrawingDocument.EndInit();

            //end view init
            nDrawingView.EndInit();
        }
コード例 #18
0
        public override void Initialize()
        {
            base.Initialize();

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Axis Sections");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);
            title.ContentAlignment    = ContentAlignment.BottomCenter;
            title.Location            = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));

            // no legend
            nChartControl1.Legends.Clear();

            m_Chart            = (NCartesianChart)nChartControl1.Charts[0];
            m_Chart.BoundsMode = BoundsMode.Stretch;

            // create a point series
            NPointSeries point = (NPointSeries)m_Chart.Series.Add(SeriesType.Point);

            point.Name = "Point Series";
            point.DataLabelStyle.Visible = false;
            point.MarkerStyle.Visible    = false;
            point.Size = new NLength(5, NGraphicsUnit.Point);
            point.Values.FillRandom(Random, 30);
            point.ShadowStyle.Type       = ShadowType.GaussianBlur;
            point.ShadowStyle.Offset     = new NPointL(3, 3);
            point.ShadowStyle.FadeLength = new NLength(5);
            point.ShadowStyle.Color      = Color.FromArgb(55, 0, 0, 0);
            point.InflateMargins         = true;

            // tell the x axis to display major and minor grid lines
            NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator();

            m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MinorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScale.MinorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MinorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MinorTickCount = 1;

            // tell the y axis to display major and minor grid lines
            linearScale = new NLinearScaleConfigurator();
            m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MinorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScale.MinorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MinorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MinorTickCount = 1;

            NTextStyle labelStyle;

            // configure the first horizontal section
            m_FirstHorizontalSection       = new NScaleSectionStyle();
            m_FirstHorizontalSection.Range = new NRange1DD(2, 8);
            m_FirstHorizontalSection.SetShowAtWall(ChartWallType.Back, true);
            m_FirstHorizontalSection.SetShowAtWall(ChartWallType.Floor, true);
            m_FirstHorizontalSection.RangeFillStyle       = new NColorFillStyle(Color.FromArgb(60, Color.Red));
            m_FirstHorizontalSection.MajorGridStrokeStyle = new NStrokeStyle(Color.Red);
            m_FirstHorizontalSection.MajorTickStrokeStyle = new NStrokeStyle(Color.DarkRed);
            m_FirstHorizontalSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Red, LinePattern.Dot, 0, 2);

            labelStyle                 = new NTextStyle();
            labelStyle.FillStyle       = new NGradientFillStyle(Color.Red, Color.DarkRed);
            labelStyle.FontStyle.Style = FontStyle.Bold;
            m_FirstHorizontalSection.LabelTextStyle = labelStyle;

            // configure the second horizontal section
            m_SecondHorizontalSection       = new NScaleSectionStyle();
            m_SecondHorizontalSection.Range = new NRange1DD(14, 18);
            m_SecondHorizontalSection.SetShowAtWall(ChartWallType.Back, true);
            m_SecondHorizontalSection.SetShowAtWall(ChartWallType.Floor, true);
            m_SecondHorizontalSection.RangeFillStyle       = new NColorFillStyle(Color.FromArgb(60, Color.Green));
            m_SecondHorizontalSection.MajorGridStrokeStyle = new NStrokeStyle(Color.Green);
            m_SecondHorizontalSection.MajorTickStrokeStyle = new NStrokeStyle(Color.DarkGreen);
            m_SecondHorizontalSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Green, LinePattern.Dot, 0, 2);

            labelStyle                 = new NTextStyle();
            labelStyle.FillStyle       = new NGradientFillStyle(Color.Green, Color.DarkGreen);
            labelStyle.FontStyle.Style = FontStyle.Bold;
            m_SecondHorizontalSection.LabelTextStyle = labelStyle;

            // configure the first vertical section
            m_FirstVerticalSection       = new NScaleSectionStyle();
            m_FirstVerticalSection.Range = new NRange1DD(20, 40);
            m_FirstVerticalSection.SetShowAtWall(ChartWallType.Back, true);
            m_FirstVerticalSection.SetShowAtWall(ChartWallType.Left, true);
            m_FirstVerticalSection.RangeFillStyle       = new NColorFillStyle(Color.FromArgb(60, Color.Blue));
            m_FirstVerticalSection.MajorGridStrokeStyle = new NStrokeStyle(Color.Blue);
            m_FirstVerticalSection.MajorTickStrokeStyle = new NStrokeStyle(Color.DarkBlue);
            m_FirstVerticalSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Blue, LinePattern.Dot, 0, 2);

            labelStyle                            = new NTextStyle();
            labelStyle.FillStyle                  = new NGradientFillStyle(Color.Blue, Color.DarkBlue);
            labelStyle.FontStyle.Style            = FontStyle.Bold;
            m_FirstVerticalSection.LabelTextStyle = labelStyle;

            // configure the second vertical section
            m_SecondVerticalSection       = new NScaleSectionStyle();
            m_SecondVerticalSection.Range = new NRange1DD(70, 90);
            m_SecondVerticalSection.SetShowAtWall(ChartWallType.Back, true);
            m_SecondVerticalSection.SetShowAtWall(ChartWallType.Left, true);
            m_SecondVerticalSection.RangeFillStyle       = new NColorFillStyle(Color.FromArgb(60, Color.Orange));
            m_SecondVerticalSection.MajorGridStrokeStyle = new NStrokeStyle(Color.Orange);
            m_SecondVerticalSection.MajorTickStrokeStyle = new NStrokeStyle(Color.DarkOrange);
            m_SecondVerticalSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Orange, LinePattern.Dot, 0, 2);

            labelStyle                             = new NTextStyle();
            labelStyle.FillStyle                   = new NGradientFillStyle(Color.Orange, Color.DarkOrange);
            labelStyle.FontStyle.Style             = FontStyle.Bold;
            m_SecondVerticalSection.LabelTextStyle = labelStyle;

            ShowFirstHorizontalSectionCheck.Checked  = true;
            ShowSecondHorizontalSectionCheck.Checked = true;
            ShowFirstVerticalSectionCheck.Checked    = true;
            ShowSecondVerticalSectionCheck.Checked   = true;
        }
コード例 #19
0
        private NRadialGaugePanel CreateRadialGauge()
        {
            // create the radial gauge
            NRadialGaugePanel radialGauge = new NRadialGaugePanel();

            radialGauge.PaintEffect      = new NGlassEffectStyle();
            radialGauge.BorderStyle      = new NEdgeBorderStyle(BorderShape.Auto);
            radialGauge.ContentAlignment = ContentAlignment.BottomCenter;

            NGaugeAxis axis = (NGaugeAxis)radialGauge.Axes[0];

            axis.Range = new NRange1DD(0, 250);

            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Presentation);
            scale.MinorTickCount = 4;
            scale.RulerStyle.BorderStyle.Width = new NLength(0);
            scale.RulerStyle.FillStyle         = new NColorFillStyle(Color.DarkGray);

            NScaleSectionStyle scaleSection = new NScaleSectionStyle();

            scaleSection.Range = new NRange1DD(220, 260);
            scaleSection.MajorTickStrokeStyle = new NStrokeStyle(Color.Red);
            scaleSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Red, LinePattern.Dot, 0, 2);

            NTextStyle labelStyle = new NTextStyle();

            labelStyle.FillStyle        = new NGradientFillStyle(Color.Red, Color.DarkRed);
            labelStyle.FontStyle.Style  = FontStyle.Bold;
            scaleSection.LabelTextStyle = labelStyle;

            scale.Sections.Add(scaleSection);

            NRangeIndicator rangeIndicator = new NRangeIndicator();

            rangeIndicator.Value             = 220;
            rangeIndicator.OriginMode        = OriginMode.ScaleMax;
            rangeIndicator.FillStyle         = new NColorFillStyle(Color.Red);
            rangeIndicator.StrokeStyle.Width = new NLength(0);
            rangeIndicator.BeginWidth        = new NLength(-2);
            rangeIndicator.EndWidth          = new NLength(-10);
            radialGauge.Indicators.Add(rangeIndicator);

            NMarkerValueIndicator markerIndicator = new NMarkerValueIndicator();

            markerIndicator.Value = 90;
            radialGauge.Indicators.Add(markerIndicator);

            NNeedleValueIndicator needleIndictor = new NNeedleValueIndicator();

            needleIndictor.Value                   = 0;
            needleIndictor.Shape.FillStyle         = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red);
            needleIndictor.Shape.StrokeStyle.Color = Color.Red;
            radialGauge.Indicators.Add(needleIndictor);

            radialGauge.BeginAngle = -240;
            radialGauge.SweepAngle = 300;

            return(radialGauge);
        }
コード例 #20
0
            /// <summary>
            /// Clears all highlighted cells.
            /// </summary>
            public void ClearHighlightedCells()
            {
                int cellCount = m_CellsToClear.Count;

                if (cellCount == 0)
                {
                    return;
                }

                string colorString = BoardShape[m_CellsToClear[0].X, m_CellsToClear[0].Y].StyleSheetName;

                colorString = colorString.Remove(colorString.Length - HighlightedSuffix.Length);
                CellCount[IndexOf(colorString)] -= cellCount;
                Score += cellCount * cellCount;

                for (int i = 0; i < cellCount; i++)
                {
                    NPoint p = m_CellsToClear[i];
                    BoardShape[p.X, p.Y].StyleSheetName = String.Empty;
                }

                // Apply gravity
                ApplyGravity();

                // Update the cell count info
                UpdateInfo();

                // Clear the cells to clear list
                m_CellsToClear.Clear();

                // Check for end of the game
                string status = String.Empty;

                if (AllClear())
                {
                    Score *= 2;
                    status = "You've cleared all cells !!!" + Environment.NewLine;
                }

                if (status == String.Empty && GameOver())
                {
                    status = "Game Over !" + Environment.NewLine;
                }

                if (status != String.Empty)
                {
                    status += "Your score is " + Score.ToString();
                    NTableShape gameOver = new NTableShape();
                    ((NDrawingDocument)BoardShape.Document).ActiveLayer.AddChild(gameOver);

                    gameOver.BeginUpdate();
                    gameOver.CellPadding = new Nevron.Diagram.NMargins(2, 2, 8, 8);
                    gameOver[0, 0].Text  = status;

                    NStyle.SetFillStyle(gameOver, new NAdvancedGradientFillStyle(AdvancedGradientScheme.Mahogany2, 5));
                    NTextStyle textStyle = (NTextStyle)InfoShape.ComposeTextStyle().Clone();
                    textStyle.FillStyle = new NColorFillStyle(Color.White);
                    NStyle.SetTextStyle(gameOver, textStyle);

                    gameOver.EndUpdate();
                    gameOver.Center = BoardShape.Center;
                }
            }
コード例 #21
0
        private void InitDocument()
        {
            document.Style.TextStyle = new NTextStyle(new Font("Arial", 9), Color.Black);

            // modify the connectors style sheet
            NStyleSheet styleSheet = (document.StyleSheets.GetChildByName(NDR.NameConnectorsStyleSheet, -1) as NStyleSheet);

            NTextStyle textStyle = new NTextStyle();

            textStyle.BackplaneStyle.Visible = true;
            textStyle.BackplaneStyle.StandardFrameStyle.InnerBorderWidth = new NLength(0);
            styleSheet.Style.TextStyle = textStyle;

            styleSheet.Style.StrokeStyle = new NStrokeStyle(1, Color.Black);
            styleSheet.Style.StartArrowheadStyle.StrokeStyle = new NStrokeStyle(1, Color.Black);
            styleSheet.Style.EndArrowheadStyle.StrokeStyle   = new NStrokeStyle(1, Color.Black);

            // create a stylesheet for the 2D Shapes
            styleSheet = new NStyleSheet("SHAPE2D");
            styleSheet.Style.FillStyle = new NColorFillStyle(Color.PapayaWhip);
            document.StyleSheets.AddChild(styleSheet);

            // create a stylesheet for the arrows, which inherits from the connectors stylesheet
            styleSheet = new NStyleSheet("ARROW", NDR.NameConnectorsStyleSheet);

            textStyle = new NTextStyle();
            textStyle.FontStyle.InitFromFont(new Font("Arial", 8));
            styleSheet.Style.TextStyle = textStyle;

            document.StyleSheets.AddChild(styleSheet);

            // create shapes
            NShape shape1 = base.CreateBasicShape(BasicShapes.Rectangle, new NRectangleF(150, 50, 50, 50), "1", "SHAPE2D");

            NShape shape2 = base.CreateBasicShape(BasicShapes.Rectangle, new NRectangleF(150, 150, 50, 50), "2", "SHAPE2D");
            NShape shape3 = base.CreateBasicShape(BasicShapes.Rectangle, new NRectangleF(325, 150, 50, 50), "3", "SHAPE2D");

            NShape shape4 = base.CreateBasicShape(BasicShapes.Rectangle, new NRectangleF(50, 250, 50, 50), "4", "SHAPE2D");
            NShape shape5 = base.CreateBasicShape(BasicShapes.Rectangle, new NRectangleF(250, 250, 50, 50), "5", "SHAPE2D");
            NShape shape6 = base.CreateBasicShape(BasicShapes.Rectangle, new NRectangleF(400, 250, 50, 50), "6", "SHAPE2D");

            NShape shape7 = base.CreateBasicShape(BasicShapes.Rectangle, new NRectangleF(250, 350, 50, 50), "7", "SHAPE2D");
            NShape shape8 = base.CreateBasicShape(BasicShapes.Rectangle, new NRectangleF(400, 350, 50, 50), "8", "SHAPE2D");

            // create connectors
            NLineShape line = new NLineShape();

            line.StyleSheetName = NDR.NameConnectorsStyleSheet;
            line.Text           = "Line";
            document.ActiveLayer.AddChild(line);
            line.StartPlug.Connect(shape1.Ports.GetChildByName("Bottom", 0) as NPort);
            line.EndPlug.Connect(shape2.Ports.GetChildByName("Top", 0) as NPort);

            NStep2Connector hv = new NStep2Connector(false);

            hv.StyleSheetName = NDR.NameConnectorsStyleSheet;
            hv.Text           = "HV";
            document.ActiveLayer.AddChild(hv);
            hv.StartPlug.Connect(shape1.Ports.GetChildByName("Right", 0) as NPort);
            hv.EndPlug.Connect(shape3.Ports.GetChildByName("Top", 0) as NPort);

            NStep2Connector vh = new NStep2Connector(true);

            vh.StyleSheetName = NDR.NameConnectorsStyleSheet;
            vh.Text           = "VH";
            document.ActiveLayer.AddChild(vh);
            vh.StartPlug.Connect(shape4.Ports.GetChildByName("Bottom", 0) as NPort);
            vh.EndPlug.Connect(shape7.Ports.GetChildByName("Left", 0) as NPort);

            NStep3Connector vhv = new NStep3Connector(true, 50, 0, true);

            vhv.StyleSheetName = NDR.NameConnectorsStyleSheet;
            vhv.Text           = "VHV";
            document.ActiveLayer.AddChild(vhv);
            vhv.StartPlug.Connect(shape2.Ports.GetChildByName("Bottom", 0) as NPort);
            vhv.EndPlug.Connect(shape4.Ports.GetChildByName("Top", 0) as NPort);

            NStep3Connector hvh = new NStep3Connector(false, 50, 0, true);

            hvh.StyleSheetName = NDR.NameConnectorsStyleSheet;
            hvh.Text           = "HVH";
            document.ActiveLayer.AddChild(hvh);
            hvh.StartPlug.Connect(shape2.Ports.GetChildByName("Right", 0) as NPort);
            hvh.EndPlug.Connect(shape5.Ports.GetChildByName("Left", 0) as NPort);

            NArrowShape doubleArrow = new NArrowShape(ArrowType.DoubleArrow, new NPointF(0, 0), new NPointF(1, 1), 10, 45, 30);

            doubleArrow.StyleSheetName = "ARROW";
            doubleArrow.Text           = "Double Arrow";
            document.ActiveLayer.AddChild(doubleArrow);
            doubleArrow.StartPlug.Connect(shape5.Ports.GetChildByName("Right", 0) as NPort);
            doubleArrow.EndPlug.Connect(shape6.Ports.GetChildByName("Left", 0) as NPort);

            NArrowShape singleArrow = new NArrowShape(ArrowType.SingleArrow, new NPointF(0, 0), new NPointF(1, 1), 10, 45, 30);

            singleArrow.StyleSheetName = "ARROW";
            singleArrow.Text           = "Single Arrow";
            document.ActiveLayer.AddChild(singleArrow);
            singleArrow.StartPlug.Connect(shape7.Ports.GetChildByName("Right", 0) as NPort);
            singleArrow.EndPlug.Connect(shape8.Ports.GetChildByName("Left", 0) as NPort);

            NBezierCurveShape bezier = new NBezierCurveShape();

            bezier.StyleSheetName = NDR.NameConnectorsStyleSheet;
            bezier.Text           = "Bezier";
            bezier.StartPlug.Connect(shape6.Ports.GetChildByName("Right", 0) as NPort);
            bezier.EndPlug.Connect(shape6.Ports.GetChildByName("Top", 0) as NPort);
            bezier.Reflex();
        }
コード例 #22
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel header = nChartControl1.Labels.AddHeader("Axis Sections");

            header.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            header.ContentAlignment           = ContentAlignment.BottomRight;
            header.Location = new NPointL(
                new NLength(2, NRelativeUnit.ParentPercentage),
                new NLength(2, NRelativeUnit.ParentPercentage));

            m_Chart            = (NCartesianChart)nChartControl1.Charts[0];
            m_Chart.BoundsMode = BoundsMode.Stretch;
            m_Chart.Location   = new NPointL(
                new NLength(2, NRelativeUnit.ParentPercentage),
                new NLength(12, NRelativeUnit.ParentPercentage));
            m_Chart.Size = new NSizeL(
                new NLength(93, NRelativeUnit.ParentPercentage),
                new NLength(85, NRelativeUnit.ParentPercentage));

            // create a point series
            NPointSeries point = (NPointSeries)m_Chart.Series.Add(SeriesType.Point);

            point.Name                   = "Point Series";
            point.Legend.Mode            = SeriesLegendMode.None;
            point.DataLabelStyle.Visible = false;
            point.MarkerStyle.Visible    = false;
            point.Size                   = new NLength(5, NGraphicsUnit.Point);
            point.Values.FillRandom(Random, 30);
            point.ShadowStyle.Type       = ShadowType.GaussianBlur;
            point.ShadowStyle.Offset     = new NPointL(3, 3);
            point.ShadowStyle.FadeLength = new NLength(5);
            point.ShadowStyle.Color      = Color.FromArgb(55, 0, 0, 0);
            point.InflateMargins         = true;

            // tell the x axis to display major and minor grid lines
            NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator();

            m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MinorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScale.MinorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MinorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MinorTickCount = 1;

            // tell the y axis to display major and minor grid lines
            linearScale = new NLinearScaleConfigurator();
            m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MinorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScale.MinorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MinorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MinorTickCount = 1;

            NTextStyle labelStyle;

            // configure the first horizontal section
            m_FirstHorizontalSection       = new NScaleSectionStyle();
            m_FirstHorizontalSection.Range = new NRange1DD(2, 8);
            m_FirstHorizontalSection.SetShowAtWall(ChartWallType.Back, true);
            m_FirstHorizontalSection.SetShowAtWall(ChartWallType.Floor, true);
            m_FirstHorizontalSection.RangeFillStyle       = new NColorFillStyle(Color.FromArgb(125, Color.Red));
            m_FirstHorizontalSection.MajorGridStrokeStyle = new NStrokeStyle(Color.Red);
            m_FirstHorizontalSection.MajorTickStrokeStyle = new NStrokeStyle(Color.DarkRed);
            m_FirstHorizontalSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Red, LinePattern.Dot, 0, 1);

            labelStyle                 = new NTextStyle();
            labelStyle.FillStyle       = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.Red, Color.DarkRed);
            labelStyle.FontStyle.Style = FontStyle.Bold;
            m_FirstHorizontalSection.LabelTextStyle = labelStyle;

            // configure the second horizontal section
            m_SecondHorizontalSection       = new NScaleSectionStyle();
            m_SecondHorizontalSection.Range = new NRange1DD(14, 18);
            m_SecondHorizontalSection.SetShowAtWall(ChartWallType.Back, true);
            m_SecondHorizontalSection.SetShowAtWall(ChartWallType.Floor, true);
            m_SecondHorizontalSection.RangeFillStyle       = new NColorFillStyle(Color.FromArgb(125, Color.Green));
            m_SecondHorizontalSection.MajorGridStrokeStyle = new NStrokeStyle(Color.Green);
            m_SecondHorizontalSection.MajorTickStrokeStyle = new NStrokeStyle(Color.DarkGreen);
            m_SecondHorizontalSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Green, LinePattern.Dot, 0, 2);

            labelStyle                 = new NTextStyle();
            labelStyle.FillStyle       = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.Green, Color.DarkGreen);
            labelStyle.FontStyle.Style = FontStyle.Bold;
            m_SecondHorizontalSection.LabelTextStyle = labelStyle;

            // configure the first vertical section
            m_FirstVerticalSection       = new NScaleSectionStyle();
            m_FirstVerticalSection.Range = new NRange1DD(20, 40);
            m_FirstVerticalSection.SetShowAtWall(ChartWallType.Back, true);
            m_FirstVerticalSection.SetShowAtWall(ChartWallType.Left, true);
            m_FirstVerticalSection.RangeFillStyle       = new NColorFillStyle(Color.FromArgb(125, Color.Blue));
            m_FirstVerticalSection.MajorGridStrokeStyle = new NStrokeStyle(Color.Blue);
            m_FirstVerticalSection.MajorTickStrokeStyle = new NStrokeStyle(Color.DarkBlue);
            m_FirstVerticalSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Blue, LinePattern.Dot, 0, 2);

            labelStyle                            = new NTextStyle();
            labelStyle.FillStyle                  = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.Blue, Color.DarkBlue);
            labelStyle.FontStyle.Style            = FontStyle.Bold;
            m_FirstVerticalSection.LabelTextStyle = labelStyle;

            // configure the second vertical section
            m_SecondVerticalSection       = new NScaleSectionStyle();
            m_SecondVerticalSection.Range = new NRange1DD(70, 90);
            m_SecondVerticalSection.SetShowAtWall(ChartWallType.Back, true);
            m_SecondVerticalSection.SetShowAtWall(ChartWallType.Left, true);
            m_SecondVerticalSection.RangeFillStyle       = new NColorFillStyle(Color.FromArgb(125, Color.Orange));
            m_SecondVerticalSection.MajorGridStrokeStyle = new NStrokeStyle(Color.Orange);
            m_SecondVerticalSection.MajorTickStrokeStyle = new NStrokeStyle(Color.DarkOrange);
            m_SecondVerticalSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Orange, LinePattern.Dot, 0, 2);

            labelStyle                             = new NTextStyle();
            labelStyle.FillStyle                   = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.Orange, Color.DarkOrange);
            labelStyle.FontStyle.Style             = FontStyle.Bold;
            m_SecondVerticalSection.LabelTextStyle = labelStyle;

            if (!Page.IsPostBack)
            {
                ShowFirstHorizontalSectionCheck.Checked  = true;
                ShowSecondHorizontalSectionCheck.Checked = true;
                ShowFirstVerticalSectionCheck.Checked    = true;
                ShowSecondVerticalSectionCheck.Checked   = true;
            }
            UpdateSections();
        }
コード例 #23
0
        private void InitDocument()
        {
            // get the drawing view document
            NDrawingDocument document = NDrawingView1.Document;

            document.GraphicsSettings.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
            document.GraphicsSettings.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            document.GraphicsSettings.PixelOffsetMode   = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;

            document.Style.FillStyle = new NColorFillStyle(Color.Linen);
            //document.BackgroundStyle.FrameStyle.Visible = false;

            // modify the connectors style sheet
            NStyleSheet styleSheet = (document.StyleSheets.GetChildByName(NDR.NameConnectorsStyleSheet, -1) as NStyleSheet);

            NTextStyle textStyle = new NTextStyle();

            textStyle.BackplaneStyle.Visible = true;
            textStyle.BackplaneStyle.StandardFrameStyle.InnerBorderWidth = new NLength(0);
            styleSheet.Style.TextStyle = textStyle;

            styleSheet.Style.StrokeStyle = new NStrokeStyle(1, Color.Black);
            styleSheet.Style.StartArrowheadStyle.StrokeStyle = new NStrokeStyle(1, Color.Black);
            styleSheet.Style.EndArrowheadStyle.StrokeStyle   = new NStrokeStyle(1, Color.Black);

            // create a stylesheet for the CPA shapes
            styleSheet = new NStyleSheet("CPA");
            styleSheet.Style.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.FromArgb(102, 204, 255), Color.FromArgb(0, 128, 128));
            document.StyleSheets.AddChild(styleSheet);

            // create a stylesheet for the CLIENT shapes
            styleSheet = new NStyleSheet("CLIENT");
            styleSheet.Style.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.FromArgb(255, 102, 0), Color.FromArgb(255, 204, 0));
            document.StyleSheets.AddChild(styleSheet);

            // create a stylesheet for the stripes
            styleSheet = new NStyleSheet("STRIPE");
            styleSheet.Style.FillStyle   = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.FromArgb(221, 221, 221));
            styleSheet.Style.StrokeStyle = new NStrokeStyle(0, Color.White);
            document.StyleSheets.AddChild(styleSheet);

            // create a stylesheet for the ABC texts
            styleSheet = new NStyleSheet("ABC");
            styleSheet.Style.TextStyle = new NTextStyle(new Font("Ariel", 12), Color.FromArgb(150, 150, 150));
            document.StyleSheets.AddChild(styleSheet);

            float abcWidth = 150;

            // configure the document
            base.DefaultGridCellSize = new NSizeF(100, 70);
            base.DefaultGridSpacing  = new NSizeF(30, 30);
            base.DefaultGridOrigin   = new NPointF(60, 30);

            document.Bounds        = new NRectangleF(0, 0, 1000, (6 * base.DefaultGridCellSize.Height) + (7 * base.DefaultGridSpacing.Height));
            document.ShadowsZOrder = ShadowsZOrder.BehindLayer;

            // create the stripes
            NRectanglePath rect = new NRectanglePath(0, 0, document.Width, document.Height / 3);

            rect.StyleSheetName = "STRIPE";
            document.ActiveLayer.AddChild(rect);

            rect = new NRectanglePath(0, document.Height / 3, document.Width, document.Height / 3);
            rect.StyleSheetName = "STRIPE";
            document.ActiveLayer.AddChild(rect);

            rect = new NRectanglePath(0, 2 * document.Height / 3, document.Width, document.Height / 3);
            rect.StyleSheetName = "STRIPE";
            document.ActiveLayer.AddChild(rect);

            // create A,B,C texts
            NTextPrimitive text = new NTextPrimitive("A", document.Width - abcWidth, 0, abcWidth, document.Height / 3);

            text.Mode           = BoxTextMode.Stretch;
            rect.StyleSheetName = "ABC";
            document.ActiveLayer.AddChild(text);

            text                = new NTextPrimitive("B", document.Width - abcWidth, document.Height / 3, abcWidth, document.Height / 3);
            text.Mode           = BoxTextMode.Stretch;
            rect.StyleSheetName = "ABC";
            document.ActiveLayer.AddChild(text);

            text                = new NTextPrimitive("C", document.Width - abcWidth, 2 * document.Height / 3, abcWidth, document.Height / 3);
            text.Mode           = BoxTextMode.Stretch;
            rect.StyleSheetName = "ABC";
            document.ActiveLayer.AddChild(text);

            // add stripe texts
            text = new NTextPrimitive("Sing up client", document.Width - abcWidth, document.Height / 3 - 50, abcWidth, 50);
            document.ActiveLayer.AddChild(text);

            text = new NTextPrimitive("Monthly Accounting Services", document.Width - abcWidth, 2 * document.Height / 3 - 50, abcWidth, 50);
            document.ActiveLayer.AddChild(text);

            text = new NTextPrimitive("Additional Services", document.Width - abcWidth, 3 * document.Height / 3 - 50, abcWidth, 50);
            document.ActiveLayer.AddChild(text);

            // create a layer for the foreground shapes
            NLayer layer = new NLayer();

            document.Layers.AddChild(layer);
            document.ActiveLayerUniqueId = layer.UniqueId;

            // all shapes in the foreground layer have a shadow
            layer.Style.ShadowStyle = new NShadowStyle(ShadowType.GaussianBlur, Color.Gray, new NPointL(5, 5), 1, new NLength(10));

            // shapes in row 1
            NShape newClient                  = base.CreateFlowChartingShape(document, FlowChartingShapes.Decision, base.GetGridCell(0, 0), "New Client", "CPA");
            NShape register                   = base.CreateFlowChartingShape(document, FlowChartingShapes.Process, base.GetGridCell(0, 1), "Register", "CPA");
            NShape clientAccountInfo          = base.CreateFlowChartingShape(document, FlowChartingShapes.Data, base.GetGridCell(0, 2), "Client account info", "CPA");
            NShape explainDataEntryProcedures = base.CreateFlowChartingShape(document, FlowChartingShapes.Process, base.GetGridCell(0, 3), "Explain data entry procedures", "CPA");

            // shapes in row 2
            NShape dataEntry         = base.CreateFlowChartingShape(document, FlowChartingShapes.ManualInput, base.GetGridCell(2, 0), "Data Entry", "CLIENT");
            NShape emailCompleted    = base.CreateFlowChartingShape(document, FlowChartingShapes.Document, base.GetGridCell(2, 1), "E-mail Completed", "CLIENT");
            NShape review            = base.CreateFlowChartingShape(document, FlowChartingShapes.Process, base.GetGridCell(2, 2), "Review", "CPA");
            NShape needsRevising     = base.CreateFlowChartingShape(document, FlowChartingShapes.Decision, base.GetGridCell(2, 3), "Needs revising", "CPA");
            NShape emailRevisions    = base.CreateFlowChartingShape(document, FlowChartingShapes.Process, base.GetGridCell(2, 4), "E-mail revisions", "CPA");
            NShape evaluateRevisions = base.CreateFlowChartingShape(document, FlowChartingShapes.Process, base.GetGridCell(2, 5), "Evaluate revisions", "CLIENT");

            // shapes in row 3
            NShape emailApprovedRevisions = base.CreateFlowChartingShape(document, FlowChartingShapes.Document, base.GetGridCell(3, 2), "E-mail Approved Revisions", "CLIENT");
            NShape evaluateRevisions2     = base.CreateFlowChartingShape(document, FlowChartingShapes.Process, base.GetGridCell(3, 4), "Evaluate Revisions", "CLIENT");
            NShape answerClientEmail      = base.CreateFlowChartingShape(document, FlowChartingShapes.Process, base.GetGridCell(3, 5), "Answer Client E-mail", "CPA");

            // shapes in row 4
            NShape paywoll    = base.CreateFlowChartingShape(document, FlowChartingShapes.Document, base.GetGridCell(5, 2), "Payroll", "CLIENT");
            NShape taxes      = base.CreateFlowChartingShape(document, FlowChartingShapes.Process, base.GetGridCell(5, 3), "Taxes", "CLIENT");
            NShape controller = base.CreateFlowChartingShape(document, FlowChartingShapes.Process, base.GetGridCell(5, 4), "Controller", "CPA");

            // some shapes need to have extra ports
            NRotatedBoundsPort port = new NRotatedBoundsPort(evaluateRevisions.UniqueId, new NContentAlignment(-25, 50));

            port.Name = "BottomLeft";
            evaluateRevisions.Ports.AddChild(port);

            port      = new NRotatedBoundsPort(evaluateRevisions.UniqueId, new NContentAlignment(+25, 50));
            port.Name = "BottomRight";
            evaluateRevisions.Ports.AddChild(port);

            port      = new NRotatedBoundsPort(answerClientEmail.UniqueId, new NContentAlignment(-25, -50));
            port.Name = "TopLeft";
            answerClientEmail.Ports.AddChild(port);

            port      = new NRotatedBoundsPort(answerClientEmail.UniqueId, new NContentAlignment(+25, -50));
            port.Name = "TopRight";
            answerClientEmail.Ports.AddChild(port);

            // connect shapes in levels
            base.CreateConnector(document, newClient, "Center", register, "Center", ConnectorType.Line, "YES");
            base.CreateConnector(document, register, "Center", clientAccountInfo, "Center", ConnectorType.Line, "");
            base.CreateConnector(document, clientAccountInfo, "Center", explainDataEntryProcedures, "Center", ConnectorType.Line, "");
            base.CreateConnector(document, dataEntry, "Center", emailCompleted, "Center", ConnectorType.Line, "");
            base.CreateConnector(document, emailCompleted, "Center", review, "Center", ConnectorType.Line, "");
            base.CreateConnector(document, review, "Center", needsRevising, "Center", ConnectorType.Line, "");
            base.CreateConnector(document, needsRevising, "Center", emailRevisions, "Center", ConnectorType.Line, "YES");
            base.CreateConnector(document, emailRevisions, "Center", evaluateRevisions, "Center", ConnectorType.Line, "");
            base.CreateConnector(document, evaluateRevisions2, "Center", emailApprovedRevisions, "Center", ConnectorType.Line, "");

            // connect accross levels
            NStep3Connector connector = (base.CreateConnector(document, newClient, "Center", dataEntry, "Center", ConnectorType.SideToSide, "NO") as NStep3Connector);

            connector.UseMiddleControlPointPercent = false;
            connector.MiddleControlPointOffset     = -55;

            base.CreateConnector(document, explainDataEntryProcedures, "Center", dataEntry, "Center", ConnectorType.TopToBottom, "");
            base.CreateConnector(document, emailApprovedRevisions, "Center", review, "Center", ConnectorType.Line, "");
            base.CreateConnector(document, emailRevisions, "Center", evaluateRevisions2, "Center", ConnectorType.Line, "");
            base.CreateConnector(document, evaluateRevisions, "BottomLeft", answerClientEmail, "TopLeft", ConnectorType.Line, "");
            base.CreateConnector(document, answerClientEmail, "TopRight", evaluateRevisions, "BottomRight", ConnectorType.Line, "");

            connector = (base.CreateConnector(document, needsRevising, "Center", paywoll, "Center", ConnectorType.TopToBottom, "") as NStep3Connector);
            connector.MiddleControlPointPercent = 66;

            connector = (base.CreateConnector(document, needsRevising, "Center", taxes, "Center", ConnectorType.TopToBottom, "") as NStep3Connector);
            connector.MiddleControlPointPercent = 66;

            connector = (base.CreateConnector(document, needsRevising, "Center", controller, "Center", ConnectorType.TopToBottom, "") as NStep3Connector);
            connector.MiddleControlPointPercent = 66;

            // create the legend as a group
            NGroup legend = new NGroup();

            NRectangleShape legendBackground = new NRectangleShape(0, 0, 1, 3);

            legendBackground.Style.FillStyle = new NColorFillStyle(Color.White);
            legend.Shapes.AddChild(legendBackground);

            NRectangleF bounds = new NRectangleF(0, 1, 1, 1);

            bounds.Inflate(-0.2f, -0.2f);

            NRectangleShape cpaItem = new NRectangleShape(bounds);

            cpaItem.Text           = "CPA";
            cpaItem.StyleSheetName = "CPA";
            legend.Shapes.AddChild(cpaItem);

            bounds = new NRectangleF(0, 2, 1, 1);
            bounds.Inflate(-0.2f, -0.2f);

            NRectangleShape clientItem = new NRectangleShape(bounds);

            clientItem.Text           = "Client";
            clientItem.StyleSheetName = "CLIENT";
            legend.Shapes.AddChild(clientItem);

            legend.UpdateModelBounds();
            legend.Bounds = base.GetGridCell(4, 0, 1, 1);

            document.ActiveLayer.AddChild(legend);
            document.SizeToContent();
        }
コード例 #24
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Axis Sections";

            m_Chart = (NCartesianChart)chartView.Surface.Charts[0];

            m_Chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear);

            // create a point series
            NPointSeries point = new NPointSeries();

            point.Name           = "Point Series";
            point.DataLabelStyle = new NDataLabelStyle(false);
            point.Size           = 5;

            Random random = new Random();

            for (int i = 0; i < 30; i++)
            {
                point.DataPoints.Add(new NPointDataPoint(random.Next(100), random.Next(100)));
            }

            point.InflateMargins = true;

            m_Chart.Series.Add(point);

            // tell the x axis to display major and minor grid lines
            NLinearScale linearScale = new NLinearScale();

            m_Chart.Axes[ENCartesianAxis.PrimaryX].Scale = linearScale;
            linearScale.MajorGridLines = new NScaleGridLines();
            linearScale.MajorGridLines.Stroke.DashStyle = ENDashStyle.Solid;
            linearScale.MinorGridLines = new NScaleGridLines();
            linearScale.MinorGridLines.Stroke.DashStyle = ENDashStyle.Dot;
            linearScale.MinorTickCount = 1;

            // tell the y axis to display major and minor grid lines
            linearScale = new NLinearScale();
            m_Chart.Axes[ENCartesianAxis.PrimaryY].Scale = linearScale;
            linearScale.MajorGridLines = new NScaleGridLines();
            linearScale.MajorGridLines.Stroke.DashStyle = ENDashStyle.Solid;
            linearScale.MinorGridLines = new NScaleGridLines();
            linearScale.MinorGridLines.Stroke.DashStyle = ENDashStyle.Dot;
            linearScale.MinorTickCount = 1;

            NTextStyle labelStyle;

            // configure the first horizontal section
            m_FirstHorizontalSection                 = new NScaleSection();
            m_FirstHorizontalSection.Range           = new NRange(2, 8);
            m_FirstHorizontalSection.RangeFill       = new NColorFill(new NColor(NColor.Red, 60));
            m_FirstHorizontalSection.MajorGridStroke = new NStroke(NColor.Red);
            m_FirstHorizontalSection.MajorTickStroke = new NStroke(NColor.DarkRed);
            m_FirstHorizontalSection.MinorTickStroke = new NStroke(1, NColor.Red, ENDashStyle.Dot);

            labelStyle            = new NTextStyle();
            labelStyle.Fill       = new NStockGradientFill(NColor.Red, NColor.DarkRed);
            labelStyle.Font.Style = ENFontStyle.Bold;
            m_FirstHorizontalSection.LabelTextStyle = labelStyle;

            // configure the second horizontal section
            m_SecondHorizontalSection                 = new NScaleSection();
            m_SecondHorizontalSection.Range           = new NRange(14, 18);
            m_SecondHorizontalSection.RangeFill       = new NColorFill(new NColor(NColor.Green, 60));
            m_SecondHorizontalSection.MajorGridStroke = new NStroke(NColor.Green);
            m_SecondHorizontalSection.MajorTickStroke = new NStroke(NColor.DarkGreen);
            m_SecondHorizontalSection.MinorTickStroke = new NStroke(1, NColor.Green, ENDashStyle.Dot);

            labelStyle            = new NTextStyle();
            labelStyle.Fill       = new NStockGradientFill(NColor.Green, NColor.DarkGreen);
            labelStyle.Font.Style = ENFontStyle.Bold;
            m_SecondHorizontalSection.LabelTextStyle = labelStyle;

            // configure the first vertical section
            m_FirstVerticalSection                 = new NScaleSection();
            m_FirstVerticalSection.Range           = new NRange(20, 40);
            m_FirstVerticalSection.RangeFill       = new NColorFill(new NColor(NColor.Blue, 60));
            m_FirstVerticalSection.MajorGridStroke = new NStroke(NColor.Blue);
            m_FirstVerticalSection.MajorTickStroke = new NStroke(NColor.DarkBlue);
            m_FirstVerticalSection.MinorTickStroke = new NStroke(1, NColor.Blue, ENDashStyle.Dot);

            labelStyle            = new NTextStyle();
            labelStyle.Fill       = new NStockGradientFill(NColor.Blue, NColor.DarkBlue);
            labelStyle.Font.Style = ENFontStyle.Bold;
            m_FirstVerticalSection.LabelTextStyle = labelStyle;

            // configure the second vertical section
            m_SecondVerticalSection                 = new NScaleSection();
            m_SecondVerticalSection.Range           = new NRange(70, 90);
            m_SecondVerticalSection.RangeFill       = new NColorFill(new NColor(NColor.Orange, 60));
            m_SecondVerticalSection.MajorGridStroke = new NStroke(NColor.Orange);
            m_SecondVerticalSection.MajorTickStroke = new NStroke(NColor.DarkOrange);
            m_SecondVerticalSection.MinorTickStroke = new NStroke(1, NColor.Orange, ENDashStyle.Dot);

            labelStyle            = new NTextStyle();
            labelStyle.Fill       = new NStockGradientFill(NColor.Orange, NColor.DarkOrange);
            labelStyle.Font.Style = ENFontStyle.Bold;
            m_SecondVerticalSection.LabelTextStyle = labelStyle;

            chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false));

            return(chartView);
        }
コード例 #25
0
        private void InitDocument()
        {
            NDrawingView1.Document.GraphicsSettings.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
            NDrawingView1.Document.GraphicsSettings.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            NDrawingView1.Document.GraphicsSettings.PixelOffsetMode   = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;

            // set up visual formatting
            NDrawingView1.Document.Style.FillStyle = new NColorFillStyle(Color.Linen);
            NDrawingView1.Document.BackgroundStyle.FrameStyle.Visible = false;

            // create the flowcharting shapes factory
            NFlowChartingShapesFactory factory = new NFlowChartingShapesFactory(NDrawingView1.Document);

            // modify the connectors style sheet
            NStyleSheet styleSheet = (NDrawingView1.Document.StyleSheets.GetChildByName(NDR.NameConnectorsStyleSheet, -1) as NStyleSheet);

            NTextStyle textStyle = new NTextStyle();

            textStyle.BackplaneStyle.Visible = true;
            textStyle.BackplaneStyle.StandardFrameStyle.InnerBorderWidth = new NLength(0);
            styleSheet.Style.TextStyle = textStyle;

            styleSheet.Style.StrokeStyle = new NStrokeStyle(1, Color.Black);
            styleSheet.Style.StartArrowheadStyle.StrokeStyle = new NStrokeStyle(1, Color.Black);
            styleSheet.Style.EndArrowheadStyle.StrokeStyle   = new NStrokeStyle(1, Color.Black);

            // create the begin shape
            NShape begin = factory.CreateShape((int)FlowChartingShapes.Termination);

            begin.Bounds = new NRectangleF(100, 100, 100, 100);
            begin.Text   = "BEGIN";
            NDrawingView1.Document.ActiveLayer.AddChild(begin);

            // create the step1 shape
            NShape step1 = factory.CreateShape((int)FlowChartingShapes.Process);

            step1.Bounds = new NRectangleF(100, 400, 100, 100);
            step1.Text   = "STEP1";
            NDrawingView1.Document.ActiveLayer.AddChild(step1);

            // connect begin and step1 with bezier link
            NBezierCurveShape bezier = new NBezierCurveShape();

            bezier.StyleSheetName = NDR.NameConnectorsStyleSheet;
            bezier.Text           = "BEZIER";
            bezier.SetPointAt(1, new NPointF(100, 300));
            bezier.SetPointAt(2, new NPointF(200, 300));
            NDrawingView1.Document.ActiveLayer.AddChild(bezier);
            bezier.FromShape = begin;
            bezier.ToShape   = step1;

            // create question1 shape
            NShape question1 = factory.CreateShape((int)FlowChartingShapes.Decision);

            question1.Bounds = new NRectangleF(300, 400, 100, 100);
            question1.Text   = "QUESTION1";
            NDrawingView1.Document.ActiveLayer.AddChild(question1);

            // connect step1 and question1 with line link
            NLineShape line = new NLineShape();

            line.StyleSheetName = NDR.NameConnectorsStyleSheet;
            line.Text           = "LINE";
            NDrawingView1.Document.ActiveLayer.AddChild(line);
            line.FromShape = step1;
            line.ToShape   = question1;

            // create the step2 shape
            NShape step2 = factory.CreateShape((int)FlowChartingShapes.Process);

            step2.Bounds = new NRectangleF(500, 100, 100, 100);
            step2.Text   = "STEP2";
            NDrawingView1.Document.ActiveLayer.AddChild(step2);

            // connect step2 and question1 with HV link
            NStep2Connector hv1 = new NStep2Connector(false);

            hv1.StyleSheetName = NDR.NameConnectorsStyleSheet;
            hv1.Text           = "HV1";
            NDrawingView1.Document.ActiveLayer.AddChild(hv1);
            hv1.FromShape = step2;
            hv1.ToShape   = question1;

            // connect question1 and step2 and with HV link
            NStep2Connector hv2 = new NStep2Connector(false);

            hv2.StyleSheetName = NDR.NameConnectorsStyleSheet;
            hv2.Text           = "HV2";
            NDrawingView1.Document.ActiveLayer.AddChild(hv2);
            hv2.FromShape = question1;
            hv2.ToShape   = step2;

            // create a self loof as bezier on step2
            NBezierCurveShape selfLoop = new NBezierCurveShape();

            selfLoop.StyleSheetName = NDR.NameConnectorsStyleSheet;
            selfLoop.Text           = "SELF LOOP";
            NDrawingView1.Document.ActiveLayer.AddChild(selfLoop);
            selfLoop.FromShape = step2;
            selfLoop.ToShape   = step2;
            selfLoop.Reflex();

            // create step3 shape
            NShape step3 = factory.CreateShape((int)FlowChartingShapes.Process);

            step3.Bounds = new NRectangleF(700, 600, 100, 100);
            step3.Text   = "STEP3";
            NDrawingView1.Document.ActiveLayer.AddChild(step3);

            // connect question1 and step3 with an HVH link
            NStep3Connector hvh1 = new NStep3Connector(false, 50, 0, true);

            hvh1.StyleSheetName = NDR.NameConnectorsStyleSheet;
            hvh1.Text           = "HVH1";
            NDrawingView1.Document.ActiveLayer.AddChild(hvh1);
            hvh1.FromShape = question1;
            hvh1.ToShape   = step3;

            // create end shape
            NShape end = factory.CreateShape((int)FlowChartingShapes.Termination);

            end.Bounds = new NRectangleF(300, 700, 100, 100);
            end.Text   = "END";
            NDrawingView1.Document.ActiveLayer.AddChild(end);

            // connect step3 and end with VH link
            NStep2Connector vh1 = new NStep2Connector(true);

            vh1.StyleSheetName = NDR.NameConnectorsStyleSheet;
            vh1.Text           = "VH1";
            NDrawingView1.Document.ActiveLayer.AddChild(vh1);
            vh1.FromShape = step3;
            vh1.ToShape   = end;

            // connect question1 and end with curve link (uses explicit ports)
            NRoutableConnector curve = new NRoutableConnector(RoutableConnectorType.DynamicCurve);

            curve.StyleSheetName = NDR.NameConnectorsStyleSheet;
            curve.Text           = "CURVE";
            NDrawingView1.Document.ActiveLayer.AddChild(curve);
            curve.StartPlug.Connect(question1.Ports.GetChildAt(3) as NPort);
            curve.EndPlug.Connect(end.Ports.GetChildAt(1) as NPort);
            curve.InsertPoint(1, new NPointF(500, 600));

            // set a shadow to the document. Since styles are inheritable all objects will reuse this shadow
            NDrawingView1.Document.Style.ShadowStyle = new NShadowStyle(
                ShadowType.GaussianBlur,
                Color.Gray,
                new NPointL(5, 5),
                1,
                new NLength(3));

            // shadows must be displayed behind document content
            NDrawingView1.Document.ShadowsZOrder = ShadowsZOrder.BehindDocument;
        }
コード例 #26
0
        private void InitDocument()
        {
            // create a rectangle shape with a 2 bounds label
            NShape shape = new NRectangleShape(base.GetGridCell(0, 0));

            shape.Style.FillStyle = new NColorFillStyle(Color.FromArgb(50, 0xcc, 0, 0));

            shape.Labels.RemoveAllChildren();

            NBoundsLabel boundsLabel = new NBoundsLabel("Label 1, Wrapped", shape.UniqueId, new Nevron.Diagram.NMargins(0, 0, 0, 50));

            shape.Labels.AddChild(boundsLabel);
            shape.Labels.DefaultLabelUniqueId = boundsLabel.UniqueId;

            boundsLabel      = new NBoundsLabel("Label 2, Stretched", shape.UniqueId, new Nevron.Diagram.NMargins(0, 0, 50, 0));
            boundsLabel.Mode = BoxTextMode.Stretch;
            shape.Labels.AddChild(boundsLabel);

            document.ActiveLayer.AddChild(shape);

            // create a rectangle shape with a 2 rotated bounds labels
            shape = new NRectangleShape(base.GetGridCell(0, 1));
            shape.Style.FillStyle = new NColorFillStyle(Color.FromArgb(50, 0, 0, 0xcc));

            shape.Labels.RemoveAllChildren();

            NRotatedBoundsLabel rotatedLabel = new NRotatedBoundsLabel("Rotated Label 1, Wrapped", shape.UniqueId, new Nevron.Diagram.NMargins(0, 0, 0, 50));

            shape.Labels.AddChild(rotatedLabel);
            shape.Labels.DefaultLabelUniqueId = rotatedLabel.UniqueId;

            rotatedLabel      = new NRotatedBoundsLabel("Rotated Label 2, Stretched", shape.UniqueId, new Nevron.Diagram.NMargins(0, 0, 50, 0));
            rotatedLabel.Mode = BoxTextMode.Stretch;
            shape.Labels.AddChild(rotatedLabel);

            document.ActiveLayer.AddChild(shape);

            // create a polyline shape with two logical line labels
            NRectangleF cell = base.GetGridCell(1, 0, 0, 1);

            shape = new NPolylineShape(new NPointF[] { cell.Location, cell.RightBottom });

            shape.Labels.RemoveAllChildren();

            NLogicalLineLabel lineLabel = new NLogicalLineLabel("Line label - start", shape.UniqueId, 0, true, true);

            shape.Labels.AddChild(lineLabel);
            shape.Labels.DefaultLabelUniqueId = lineLabel.UniqueId;

            // alter the start label text style
            NTextStyle textStyle = document.Style.TextStyle.Clone() as NTextStyle;

            textStyle.StringFormatStyle.HorzAlign = HorzAlign.Left;
            textStyle.Offset = new NPointL(0, -7);
            NStyle.SetTextStyle(lineLabel, textStyle);

            // add the end label
            lineLabel = new NLogicalLineLabel("Line label - end", shape.UniqueId, 100, true, true);
            shape.Labels.AddChild(lineLabel);

            // alter the end label text style
            textStyle = document.Style.TextStyle.Clone() as NTextStyle;
            textStyle.StringFormatStyle.HorzAlign = HorzAlign.Right;
            textStyle.Offset = new NPointL(0, -7);
            NStyle.SetTextStyle(lineLabel, textStyle);

            document.ActiveLayer.AddChild(shape);
        }
コード例 #27
0
        private void ImportData()
        {
            NDrawingDocument document = NDrawingView1.Document;

            document.BackgroundStyle.FrameStyle.Visible = false;

            // create two stylesheets - one for the vertices and one for the edges
            NStyleSheet vertexStyleSheet = new NStyleSheet();

            vertexStyleSheet.Name = "Vertices";
            NStyle.SetFillStyle(vertexStyleSheet, new NColorFillStyle(Color.FromArgb(236, 97, 49)));
            document.StyleSheets.AddChild(vertexStyleSheet);

            NStyleSheet edgeStyleSheet = new NStyleSheet();

            edgeStyleSheet.Name = "Edges";
            NStyle.SetStrokeStyle(edgeStyleSheet, new NStrokeStyle(Color.Blue));
            NStyle.SetEndArrowheadStyle(edgeStyleSheet, new NArrowheadStyle(ArrowheadShape.OpenedArrow, null, new NSizeL(6, 4), null, new NStrokeStyle(Color.Blue)));
            NTextStyle textStyle = (NTextStyle)document.ComposeTextStyle().Clone();

            textStyle.StringFormatStyle.VertAlign = Nevron.VertAlign.Bottom;
            NStyle.SetTextStyle(edgeStyleSheet, textStyle);
            document.StyleSheets.AddChild(edgeStyleSheet);

            // create the graph data source importer
            NGraphDataSourceImporter graphImporter = new NGraphDataSourceImporter();

            // set the document in the active layer of which the shapes will be imported
            graphImporter.Document = document;

            // SET THE DATA SOURCE
            // the tree data source importer supports the following data sources
            //      DataTable
            //      DataView
            //      OleDbDataAdapter
            //      SqlDataAdapter
            //      OdbcDataAdapter
            //      OleDbCommand
            //      SqlCommand
            //      OdbcCommand
            // in this example we have created an OleDbDataAdapter,
            // which selects all columns and records from the Sources and Links tables of the Data.xlsx file
            string databasePath     = Server.MapPath(@"..\Examples\Import\Data.xlsx");
            string connectionString = @"Data Source=""" + databasePath + @""";Provider=""Microsoft.ACE.OLEDB.12.0""; Extended Properties=""Excel 12.0 Xml;HDR=YES"";";

            graphImporter.VertexDataSource = new OleDbDataAdapter("SELECT * FROM [Sources$]", connectionString);
            graphImporter.EdgeDataSource   = new OleDbDataAdapter("SELECT * FROM [Links$]", connectionString);

            // vertex records are uniquely identified by their Id (in the Sources table)
            // edges link the vertices with the Fro and ToPageId (in the Links table)
            graphImporter.VertexIdColumnName     = "Id";
            graphImporter.FromVertexIdColumnName = "From";
            graphImporter.ToVertexIdColumnName   = "To";

            // create vertices as group shapes, with default size
            NShapesFactory shapesFactory = new GroupShapesFactory();

            shapesFactory.DefaultSize         = VertexSize;
            graphImporter.VertexShapesFactory = shapesFactory;
            graphImporter.VertexShapesName    = GroupShapes.Group.ToString();

            // set stylesheets to be applied to imported vertices and edges
            graphImporter.VertexStyleSheetName = "Vertices";
            graphImporter.EdgeStyleSheetName   = "Edges";

            // use layered graph layout
            NLayeredGraphLayout layout = new NLayeredGraphLayout();

            layout.LayerSpacing   = 70;
            layout.Direction      = LayoutDirection.LeftToRight;
            layout.LayerAlignment = RelativeAlignment.Near;
            graphImporter.Layout  = layout;

            // subscribe for the vertex and edge imported events,
            // which are raised when a shape was created for a data source record
            graphImporter.VertexImported += new ShapeImportedDelegate(OnVertexImported);
            graphImporter.EdgeImported   += new ShapeImportedDelegate(OnEdgeImported);

            // import
            graphImporter.Import();
        }
コード例 #28
0
        protected void NDrawingView1_AsyncClick(object sender, EventArgs e)
        {
            NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs;

            NNodeList nodes  = NDrawingView1.HitTest(args);
            NNodeList shapes = nodes.Filter(CELL_FILTER);

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

            NTableCell cell = (NTableCell)shapes[0];

            if (cell.ParentNode.ParentNode != table)
            {
                return;
            }

            if (cell.StyleSheetName != null && cell.StyleSheetName != string.Empty)
            {
                if (CellClicked(cell))
                {
                    UpdateInfo();

                    // Check for end of the game
                    string status = string.Empty;
                    if (AllClear())
                    {
                        score *= 2;
                        status = "You've cleared all cells !!!" + Environment.NewLine;
                    }

                    if (status == string.Empty && GameOver())
                    {
                        status = "Game Over !" + Environment.NewLine;
                    }

                    if (status != string.Empty)
                    {
                        status += "Your score is " + score.ToString();
                        NTableShape gameOver = new NTableShape();
                        document.ActiveLayer.AddChild(gameOver);

                        gameOver.BeginUpdate();
                        gameOver.CellPadding = new Nevron.Diagram.NMargins(2, 2, 8, 8);
                        gameOver[0, 0].Text  = status;

                        NStyle.SetFillStyle(gameOver, new NAdvancedGradientFillStyle(AdvancedGradientScheme.Ocean1, 0));
                        NStyle.SetStrokeStyle(gameOver, new NStrokeStyle(Color.DarkBlue));

                        NTextStyle textStyle = (NTextStyle)table.ComposeTextStyle().Clone();
                        textStyle.FillStyle = new NColorFillStyle(Color.DarkBlue);
                        NStyle.SetTextStyle(gameOver, textStyle);

                        gameOver.EndUpdate();
                        gameOver.Center = table.Center;
                    }
                }
            }
        }
コード例 #29
0
        private void InitDocument()
        {
            // modify the connectors style sheet
            NStyleSheet styleSheet = (NDrawingView1.Document.StyleSheets.GetChildByName(NDR.NameConnectorsStyleSheet, -1) as NStyleSheet);

            NTextStyle textStyle = new NTextStyle();

            textStyle.BackplaneStyle.Visible = true;
            textStyle.BackplaneStyle.StandardFrameStyle.InnerBorderWidth = new NLength(0);
            textStyle.BackplaneStyle.FillStyle = new NColorFillStyle(Color.FromArgb(200, Color.White));
            styleSheet.Style.TextStyle         = textStyle;

            styleSheet.Style.StrokeStyle = new NStrokeStyle(1, Color.Black);
            styleSheet.Style.StartArrowheadStyle.StrokeStyle = new NStrokeStyle(Color.FromArgb(0, Color.Black));
            styleSheet.Style.StartArrowheadStyle.FillStyle   = new NColorFillStyle(Color.FromArgb(0, Color.White));
            styleSheet.Style.EndArrowheadStyle.StrokeStyle   = new NStrokeStyle(1, Color.Black);

            // modify default stroke style
            NDrawingView1.Document.Style.StrokeStyle = new NStrokeStyle(Color.FromArgb(0, Color.White));

            // configure the document
            NDrawingView1.Document.Bounds = new NRectangleF(0, 0, 420, 320);
            NDrawingView1.Document.GraphicsSettings.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
            NDrawingView1.Document.GraphicsSettings.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            NDrawingView1.Document.GraphicsSettings.PixelOffsetMode   = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
            NDrawingView1.Document.MeasurementUnit  = NGraphicsUnit.Pixel;
            NDrawingView1.Document.DrawingScaleMode = DrawingScaleMode.NoScale;

            NDrawingView1.Document.BackgroundStyle.FrameStyle.Visible = false;

            //	predefined styles
            NAdvancedGradientFillStyle ag1 = new NAdvancedGradientFillStyle();

            ag1.BackgroundColor = Color.Navy;
            ag1.Points.Add(new NAdvancedGradientPoint(Color.SkyBlue, 50, 50, 0, 79, AGPointShape.Circle));

            NAdvancedGradientFillStyle ag2 = new NAdvancedGradientFillStyle();

            ag2.BackgroundColor = Color.DarkRed;
            ag2.Points.Add(new NAdvancedGradientPoint(Color.Red, 50, 50, 0, 71, AGPointShape.Circle));

            NAdvancedGradientFillStyle ag3 = new NAdvancedGradientFillStyle();

            ag3.BackgroundColor = Color.Orange;
            ag3.Points.Add(new NAdvancedGradientPoint(Color.Yellow, 50, 50, 0, 50, AGPointShape.Circle));

            //	shapes
            NBasicShapesFactory factory = new NBasicShapesFactory(NDrawingView1.Document);

            NEllipseShape centerEllipse = factory.CreateShape((int)BasicShapes.Ellipse) as NEllipseShape;

            centerEllipse.Name                     = "CenterEllipse";
            centerEllipse.Width                    = 50f;
            centerEllipse.Height                   = 50f;
            centerEllipse.Center                   = new NPointF(210, 160);
            centerEllipse.Style.StrokeStyle        = null;
            centerEllipse.Style.FillStyle          = ag3;
            centerEllipse.Style.InteractivityStyle = new NInteractivityStyle(true, centerEllipse.Name);

            NEllipseShape rotatingEllipse = factory.CreateShape((int)BasicShapes.Ellipse) as NEllipseShape;

            rotatingEllipse.Name                     = "RotatingEllipse";
            rotatingEllipse.Width                    = 35f;
            rotatingEllipse.Height                   = 35f;
            rotatingEllipse.Center                   = new NPointF(centerEllipse.Bounds.X - 100, centerEllipse.Center.Y);
            rotatingEllipse.Style.StrokeStyle        = null;
            rotatingEllipse.Style.FillStyle          = ag1;
            rotatingEllipse.PinPoint                 = new NPointF(centerEllipse.Center.X, centerEllipse.Center.Y);
            rotatingEllipse.Style.InteractivityStyle = new NInteractivityStyle(true, rotatingEllipse.Name);

            NEllipseShape rotatingEllipse2 = factory.CreateShape((int)BasicShapes.Ellipse) as NEllipseShape;

            rotatingEllipse2.Name                     = "RotatingEllipse2";
            rotatingEllipse2.Width                    = 15f;
            rotatingEllipse2.Height                   = 15f;
            rotatingEllipse2.Center                   = new NPointF(centerEllipse.Bounds.Right + 30, centerEllipse.Center.Y);
            rotatingEllipse2.Style.StrokeStyle        = null;
            rotatingEllipse2.Style.FillStyle          = ag2;
            rotatingEllipse2.PinPoint                 = new NPointF(centerEllipse.Center.X, centerEllipse.Center.Y);
            rotatingEllipse2.Style.InteractivityStyle = new NInteractivityStyle(true, rotatingEllipse2.Name);

            NEllipseShape orbit1 = factory.CreateShape((int)BasicShapes.Ellipse) as NEllipseShape;

            orbit1.Name                      = "orbit1";
            orbit1.Width                     = 2 * (centerEllipse.Center.X - rotatingEllipse.Center.X);
            orbit1.Height                    = orbit1.Width;
            orbit1.Center                    = new NPointF(centerEllipse.Center.X, centerEllipse.Center.Y);
            orbit1.Style.StrokeStyle         = new NStrokeStyle(Color.Black);
            orbit1.Style.StrokeStyle.Pattern = LinePattern.Dot;
            orbit1.Style.StrokeStyle.Factor  = 2;
            orbit1.Style.FillStyle           = new NColorFillStyle(Color.FromArgb(0, Color.White));

            NEllipseShape orbit2 = factory.CreateShape((int)BasicShapes.Ellipse) as NEllipseShape;

            orbit2.Name                      = "orbit2";
            orbit2.Width                     = 2 * (centerEllipse.Center.X - rotatingEllipse2.Center.X);
            orbit2.Height                    = orbit2.Width;
            orbit2.Center                    = new NPointF(centerEllipse.Center.X, centerEllipse.Center.Y);
            orbit2.Style.StrokeStyle         = new NStrokeStyle(Color.Black);
            orbit2.Style.StrokeStyle.Pattern = LinePattern.Dot;
            orbit2.Style.StrokeStyle.Factor  = 2;
            orbit2.Style.FillStyle           = new NColorFillStyle(Color.FromArgb(0, Color.White));

            NDrawingView1.Document.ActiveLayer.AddChild(orbit1);
            NDrawingView1.Document.ActiveLayer.AddChild(orbit2);
            NDrawingView1.Document.ActiveLayer.AddChild(centerEllipse);
            NDrawingView1.Document.ActiveLayer.AddChild(rotatingEllipse);
            NDrawingView1.Document.ActiveLayer.AddChild(rotatingEllipse2);

            // some shapes need to have extra ports
            NRotatedBoundsPort port = new NRotatedBoundsPort(centerEllipse.UniqueId, ContentAlignment.MiddleCenter);

            port.Name = "MiddleCenter";
            centerEllipse.Ports.AddChild(port);

            port      = new NRotatedBoundsPort(rotatingEllipse.UniqueId, ContentAlignment.MiddleCenter);
            port.Name = "MiddleCenter";
            rotatingEllipse.Ports.AddChild(port);

            // connect shapes in levels
            NShape connector           = base.CreateConnector(NDrawingView1.Document, centerEllipse, "MiddleCenter", rotatingEllipse, "MiddleCenter", ConnectorType.Line, "Radius");
            NInteractivityStyle istyle = connector.ComposeInteractivityStyle();
        }
コード例 #30
0
        public override void Create()
        {
            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel header = new NLabel("Gauge Custom Labels");

            header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);
            header.ContentAlignment    = ContentAlignment.BottomRight;
            header.Location            = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));

            nChartControl1.Panels.Add(header);

            // create the radial gauge
            NRadialGaugePanel radialGauge = new NRadialGaugePanel();

            radialGauge.Location    = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(12, NRelativeUnit.ParentPercentage));
            radialGauge.Size        = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage));
            radialGauge.PaintEffect = new NGlassEffectStyle();
            radialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto);

            NAdvancedGradientFillStyle advGradient = new NAdvancedGradientFillStyle();

            advGradient.BackgroundColor = Color.Black;
            advGradient.Points.Add(new NAdvancedGradientPoint(Color.White, 10, 10, 0, 100, AGPointShape.Circle));
            radialGauge.BackgroundFillStyle = advGradient;

            radialGauge.SweepAngle = 360;
            radialGauge.BeginAngle = -90;
            nChartControl1.Panels.Add(radialGauge);

            NGaugeAxis axis = (NGaugeAxis)radialGauge.Axes[0];

            axis.Range = new NRange1DD(0, 60);
            axis.Anchor.RulerOrientation = RulerOrientation.Right;
            axis.Anchor = new NDockGaugeAxisAnchor(GaugeAxisDockZone.Top, true, RulerOrientation.Right, 0, 100);
            NLinearScaleConfigurator scale = (NLinearScaleConfigurator)axis.ScaleConfigurator;

            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(20, Color.LightGray)), null, true, 0, 0, 1, 1);

            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.Interlaced = true;
            scale.StripStyles.Add(stripStyle);
            scale.MinorTickCount = 4;
            scale.MajorTickMode  = MajorTickMode.CustomStep;
            scale.CustomStep     = 5.0f;
            scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Watch);
            scale.OuterMajorTickStyle.FillStyle = new NGradientFillStyle(Color.White, Color.Beige);
            scale.OuterMajorTickStyle.LineStyle = new NStrokeStyle(Color.DarkGray);
            scale.OuterMajorTickStyle.Length    = new NLength(14);
            scale.RulerStyle.FillStyle          = new NColorFillStyle(Color.FromArgb(50, Color.Silver));
            scale.RulerStyle.BorderStyle        = new NStrokeStyle(Color.Beige);

            axis.UpdateScale();
            axis.SynchronizeScaleWithConfigurator = false;

            NTextStyle textStyle1 = new NTextStyle();

            textStyle1.FillStyle        = new NColorFillStyle(Color.White);
            textStyle1.BorderStyle      = new NStrokeStyle(1, Color.Beige);
            textStyle1.FontStyle.Style  = System.Drawing.FontStyle.Bold;
            textStyle1.FontStyle.EmSize = new NLength(22);
            NScaleLabelAngle angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0);

            NTextStyle textStyle2 = new NTextStyle();

            textStyle2.FillStyle        = new NColorFillStyle(Color.White);
            textStyle2.BorderStyle      = new NStrokeStyle(1, Color.Beige);
            textStyle2.FontStyle.Style  = System.Drawing.FontStyle.Bold;
            textStyle2.FontStyle.EmSize = new NLength(12);

            NCustomScaleDecorator customDecorator = new NCustomScaleDecorator();

            NValueScaleLabelStyle style1 = new NValueScaleLabelStyle(textStyle1, ContentAlignment.MiddleCenter, angle, new NLength(0));
            NValueScaleLabelStyle style2 = new NValueScaleLabelStyle(textStyle2, ContentAlignment.MiddleCenter, angle, new NLength(0));

            for (int i = 12; i > 0; i--)
            {
                string           text = NSystem.IntToRoman(i);
                NValueScaleLabel hourLabel;

                if (i % 3 == 0)
                {
                    hourLabel = new NValueScaleLabel(new NScaleValueDecorationAnchor(i * 5), text, (NValueScaleLabelStyle)style1.Clone());
                }
                else
                {
                    hourLabel = new NValueScaleLabel(new NScaleValueDecorationAnchor(i * 5), text, (NValueScaleLabelStyle)style2.Clone());
                }

                customDecorator.Decorations.Add(hourLabel);
            }

            NScaleLevel textLevel = (NScaleLevel)axis.Scale.Levels[1];

            textLevel.Decorators.Clear();
            textLevel.Decorators.Add(customDecorator);

            m_HoursArrow                         = new NNeedleValueIndicator();
            m_HoursArrow.Value                   = 79;
            m_HoursArrow.Shape.FillStyle         = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red);
            m_HoursArrow.Shape.StrokeStyle.Color = Color.Red;
            m_HoursArrow.OffsetOriginMode        = IndicatorOffsetOriginMode.ScaleEnd;
            m_HoursArrow.OffsetFromScale         = new NLength(30);
            m_HoursArrow.Width                   = new NLength(8);
            radialGauge.Indicators.Add(m_HoursArrow);

            m_MinituesArrow                         = new NNeedleValueIndicator();
            m_MinituesArrow.Value                   = 79;
            m_MinituesArrow.Shape.FillStyle         = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red);
            m_MinituesArrow.Shape.StrokeStyle.Color = Color.Red;
            m_MinituesArrow.OffsetOriginMode        = IndicatorOffsetOriginMode.ScaleEnd;
            m_MinituesArrow.OffsetFromScale         = new NLength(30);
            m_MinituesArrow.Width                   = new NLength(5);
            radialGauge.Indicators.Add(m_MinituesArrow);

            m_SecondsArrow                         = new NNeedleValueIndicator();
            m_SecondsArrow.Value                   = 79;
            m_SecondsArrow.Shape.FillStyle         = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red);
            m_MinituesArrow.OffsetOriginMode       = IndicatorOffsetOriginMode.ScaleEnd;
            m_SecondsArrow.Shape.StrokeStyle.Color = Color.Red;
            m_SecondsArrow.OffsetFromScale         = new NLength(10);
            m_SecondsArrow.Width                   = new NLength(1);
            radialGauge.Indicators.Add(m_SecondsArrow);

            //nChartControl1.AutoRefresh = true;
            SynchronizeWithTime();

            m_Timer           = new DispatcherTimer();
            m_Timer.Interval  = new TimeSpan(1000);
            m_Timer.Tick     += m_Timer_Tick;
            m_Timer.IsEnabled = true;
            m_Timer.Start();
        }