Esempio n. 1
0
        private void EndColorBack_Click(object sender, System.EventArgs e)
        {
            NHatchFillStyle hatchFillStyle = (NHatchFillStyle)nChartControl1.BackgroundStyle.FillStyle;

            colorDialog1.Color = hatchFillStyle.ForegroundColor;

            if (colorDialog1.ShowDialog() == DialogResult.OK)
            {
                hatchFillStyle.ForegroundColor = colorDialog1.Color;
                nChartControl1.Refresh();
            }
        }
Esempio n. 2
0
        private void HatchComboBack_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (m_bSkipUpdate)
            {
                return;
            }

            NHatchFillStyle hatchFillStyle = (NHatchFillStyle)nChartControl1.BackgroundStyle.FillStyle;

            hatchFillStyle.Style = GetHatchStyleFromCombo(HatchComboBack);
            nChartControl1.Refresh();
        }
Esempio n. 3
0
        private void EndColorWalls_Click(object sender, System.EventArgs e)
        {
            NHatchFillStyle hatchFillStyle = (NHatchFillStyle)m_Chart.Wall(ChartWallType.Back).FillStyle;

            colorDialog1.Color = hatchFillStyle.ForegroundColor;

            if (colorDialog1.ShowDialog() == DialogResult.OK)
            {
                hatchFillStyle.ForegroundColor = colorDialog1.Color;

                m_Chart.Wall(ChartWallType.Back).FillStyle  = hatchFillStyle;
                m_Chart.Wall(ChartWallType.Left).FillStyle  = hatchFillStyle;
                m_Chart.Wall(ChartWallType.Floor).FillStyle = hatchFillStyle;

                nChartControl1.Refresh();
            }
        }
Esempio n. 4
0
        private void InitDocument()
        {
            Bitmap bitmap = NResourceHelper.BitmapFromResource(GetType(), "Airplane.png", "Nevron.Examples.Diagram.WinForm.Resources");

            document.Width  = bitmap.Width;
            document.Height = bitmap.Height + 62;

            document.BackgroundStyle.FillStyle = new NImageFillStyle(bitmap);

            // Create the style sheets
            NStyleSheet free = new NStyleSheet("free");

            NStyle.SetInteractivityStyle(free, new NInteractivityStyle(string.Empty, CursorType.Hand));
            NStyle.SetFillStyle(free, new NColorFillStyle(SEAT_COLOR));
            NStyle.SetStrokeStyle(free, new NStrokeStyle(1, Color.Black));
            NStyle.SetTextStyle(free, new NTextStyle(new Font(view.Font, FontStyle.Bold), Color.Blue));
            document.StyleSheets.AddChild(free);

            NStyleSheet     reserved = new NStyleSheet("reserved");
            NHatchFillStyle hatch    = new NHatchFillStyle(HatchStyle.LightUpwardDiagonal, Color.Red, SEAT_COLOR);

            hatch.TextureMappingStyle.MapMode = MapMode.RelativeToViewer;
            NStyle.SetFillStyle(reserved, hatch);
            NStyle.SetStrokeStyle(reserved, new NStrokeStyle(1, Color.Black));
            document.StyleSheets.AddChild(reserved);

            float  x, y;
            float  distance = DISTANCE;
            NShape shape;
            Point  startPoint = LINE1_LEFT;

            m_Seats = new List <NShape>();

            // Draw the seats
            for (y = LINE1_LEFT.Y; y < 350; y += SEAT_SIZE.Height)
            {
                if (y > 260 && y < LINE2_LEFT.Y)
                {
                    y          = LINE2_LEFT.Y;
                    startPoint = LINE2_LEFT;
                }

                if (y >= LINE2_LEFT.Y)
                {
                    distance = 5.25f;
                }

                for (x = startPoint.X; x < 970; x += SEAT_SIZE.Width + distance)
                {
                    if (x > 460 && x < LINE1_RIGHT.X)
                    {
                        x        = LINE1_RIGHT.X;
                        distance = DISTANCE;
                    }

                    m_nFreeSeats++;
                    shape = new NRectangleShape(x, y, SEAT_SIZE.Width, SEAT_SIZE.Height);
                    shape.StyleSheetName = "free";
                    SetProtections(shape);
                    document.ActiveLayer.AddChild(shape);
                    m_Seats.Add(shape);
                }
            }

            // Free seats
            shape = new NRectangleShape(MARGINS, MARGINS, SEAT_SIZE.Width, SEAT_SIZE.Height);
            shape.StyleSheetName = "free";
            SetProtections(shape);
            document.ActiveLayer.AddChild(shape);

            CreateTextShape(ref m_FreeSeats);
            m_FreeSeats.Location = new NPointF(shape.Bounds.Right + MARGINS, shape.Bounds.Y);

            // Reserved seats
            shape = new NRectangleShape(MARGINS, 2 * MARGINS + SEAT_SIZE.Height, SEAT_SIZE.Width, SEAT_SIZE.Height);
            shape.StyleSheetName = "reserved";
            SetProtections(shape);
            document.ActiveLayer.AddChild(shape);

            CreateTextShape(ref m_ReservedSeats);
            m_ReservedSeats.Location = new NPointF(shape.Bounds.Right + MARGINS, shape.Bounds.Y);

            // Total revenue
            CreateTextShape(ref m_Revenue);
            m_Revenue.Location = new NPointF(shape.Bounds.Right + MARGINS, shape.Bounds.Bottom + MARGINS);
            m_Revenue.Style.TextStyle.FontStyle.Style = FontStyle.Bold;
            m_Revenue.Style.TextStyle.FillStyle       = new NColorFillStyle(Color.MediumBlue);

            UpdateTexts();
        }
Esempio n. 5
0
        public override void Initialize()
        {
            base.Initialize();

            // Set background pattern
            nChartControl1.BackgroundStyle.FillStyle = new NHatchFillStyle(HatchStyle.ZigZag, Color.FromArgb(187, 221, 255), Color.White);

            // add label
            NLabel title = nChartControl1.Labels.AddHeader("Hatch Fill Style");

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

            // setup chart
            m_Chart = nChartControl1.Charts[0];
            m_Chart.Axis(StandardAxis.Depth).Visible = false;

            // hide y axis grid lines
            NStandardScaleConfigurator scaleConfigurator = (NStandardScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;

            scaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, false);
            scaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Left, false);

            // hide x axis grid lines
            scaleConfigurator = (NStandardScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator;
            scaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, false);
            scaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Left, false);

            // set the projection to tilted
            m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted);

            m_Chart.Projection.Rotation = -14;
            m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft);

            // Setup walls
            Color           c = Color.FromArgb(128, 128, 192);
            NHatchFillStyle hatchFillstyle = new NHatchFillStyle(HatchStyle.Weave, Color.White, c);

            m_Chart.Wall(ChartWallType.Back).FillStyle  = hatchFillstyle;
            m_Chart.Wall(ChartWallType.Left).FillStyle  = hatchFillstyle;
            m_Chart.Wall(ChartWallType.Floor).FillStyle = hatchFillstyle;

            // Create a bar series
            m_Bar = (NFloatBarSeries)m_Chart.Series.Add(SeriesType.FloatBar);
            m_Bar.DataLabelStyle.Visible = false;
            m_Bar.BarShape       = BarShape.Bar;
            m_Bar.BarEdgePercent = 50;
            m_Bar.WidthPercent   = 60;
            m_Bar.DepthPercent   = 60;
            m_Bar.Legend.Mode    = SeriesLegendMode.DataPoints;
            m_Bar.FillStyle      = new NHatchFillStyle(HatchStyle.LargeConfetti, Color.Green, Color.Yellow);

            m_Bar.AddDataPoint(new NFloatBarDataPoint(2.0, 24.0));
            m_Bar.AddDataPoint(new NFloatBarDataPoint(21.0, 60.0));
            m_Bar.AddDataPoint(new NFloatBarDataPoint(22.0, 53.0));
            m_Bar.AddDataPoint(new NFloatBarDataPoint(34.0, 80.0));
            m_Bar.AddDataPoint(new NFloatBarDataPoint(11.0, 62.0));

            // init form controls
            string[] arrHatchNames = Enum.GetNames(typeof(HatchStyle));

            HatchComboBars.Items.AddRange(arrHatchNames);
            HatchComboWalls.Items.AddRange(arrHatchNames);
            HatchComboBack.Items.AddRange(arrHatchNames);

            m_bSkipUpdate = true;

            SetHatchStyleFromCombo(HatchComboBars, ((NHatchFillStyle)m_Bar.FillStyle).Style);
            SetHatchStyleFromCombo(HatchComboWalls, ((NHatchFillStyle)m_Chart.Wall(ChartWallType.Back).FillStyle).Style);
            SetHatchStyleFromCombo(HatchComboBack, ((NHatchFillStyle)nChartControl1.BackgroundStyle.FillStyle).Style);

            m_bSkipUpdate = false;
        }