コード例 #1
0
        private void RecreateSymbols()
        {
            NColor color  = m_ColorBox.SelectedColor;
            double length = InitialSize * Math.Pow(2, m_RadioGroup.SelectedIndex);
            NSize  size   = new NSize(length, length);

            m_SymbolsTable.Clear();

            // Create a triangle up symbol
            NPolygonSymbolShape shape = new NPolygonSymbolShape(new NPoint[] {
                new NPoint(0, size.Height),
                new NPoint(size.Width * 0.5, 0),
                new NPoint(size.Width, size.Height)
            }, ENFillRule.EvenOdd);

            shape.Fill = new NColorFill(color);

            NSymbol symbol1 = new NSymbol();

            symbol1.Add(shape);
            AddSymbolBox(symbol1, "Triangle Up");

            // Create a rectangle with an ellipse
            NRectangleSymbolShape rectShape = new NRectangleSymbolShape(0, 0, size.Width, size.Height);

            rectShape.Fill = new NColorFill(color);

            NEllipseSymbolShape ellipseShape = new NEllipseSymbolShape(size.Width / 4, size.Height / 4,
                                                                       size.Width / 2, size.Height / 2);

            ellipseShape.Fill = new NColorFill(color.Invert());

            NSymbol symbol2 = new NSymbol();

            symbol2.Add(rectShape);
            symbol2.Add(ellipseShape);
            AddSymbolBox(symbol2, "Rectangle with an ellipse");
        }