コード例 #1
0
        private NWidget CreateComputerInfoWidget(NMobileCopmuterInfo info)
        {
            NStackPanel stack = new NStackPanel();

            stack.Add(CreateHeaderLabel(info.Name));

            // Create a pair box with the image and the description
            NLabel descriptionLabel = new NLabel(info.Description);

            descriptionLabel.TextWrapMode = ENTextWrapMode.WordWrap;

            NPairBox pairBox = new NPairBox(info.Image, descriptionLabel);

            pairBox.Box1.Border          = NBorder.CreateFilledBorder(NColor.Black);
            pairBox.Box1.BorderThickness = new NMargins(1);
            pairBox.Spacing = 5;
            stack.Add(pairBox);

            NButton backButton = new NButton("Back");

            backButton.Content.HorizontalPlacement = ENHorizontalPlacement.Center;
            backButton.Tag = 0;
            stack.Add(backButton);

            return(stack);
        }
コード例 #2
0
        protected override NWidget CreateExampleContent()
        {
            // Create a dock panel with red border
            m_DockPanel                 = new NDockPanel();
            m_DockPanel.Border          = NBorder.CreateFilledBorder(NColor.Red);
            m_DockPanel.BorderThickness = new NMargins(1);

            // Create and dock several widgets
            NWidget widget = CreateDockedWidget(ENDockArea.Left);

            widget.PreferredSize = new NSize(100, 100);
            m_DockPanel.Add(widget);

            widget = CreateDockedWidget(ENDockArea.Top);
            widget.PreferredSize = new NSize(100, 100);
            m_DockPanel.Add(widget);

            widget = CreateDockedWidget(ENDockArea.Right);
            widget.PreferredSize = new NSize(100, 100);
            m_DockPanel.Add(widget);

            widget = CreateDockedWidget(ENDockArea.Bottom);
            widget.PreferredSize = new NSize(100, 100);
            m_DockPanel.Add(widget);

            widget = CreateDockedWidget(ENDockArea.Center);
            widget.PreferredSize = new NSize(300, 300);
            m_DockPanel.Add(widget);

            return(m_DockPanel);
        }
コード例 #3
0
        protected override NWidget CreateExampleContent()
        {
            m_SingleVisiblePanel = new NSingleVisiblePanel();
            m_SingleVisiblePanel.HorizontalPlacement = ENHorizontalPlacement.Left;
            m_SingleVisiblePanel.VerticalPlacement   = ENVerticalPlacement.Top;
            m_SingleVisiblePanel.PreferredWidth      = 400;
            m_SingleVisiblePanel.Border          = NBorder.CreateFilledBorder(NColor.Red);
            m_SingleVisiblePanel.BorderThickness = new NMargins(1);

            NStackPanel mainStack = new NStackPanel();

            m_SingleVisiblePanel.Add(mainStack);

            mainStack.Add(CreateHeaderLabel("Mobile Computers"));

            for (int i = 0, count = MobileComputers.Length; i < count; i++)
            {
                NMobileCopmuterInfo info = MobileComputers[i];

                // Create the topic's button
                NButton button = new NButton(info.Name);
                button.Tag = i + 1;
                mainStack.Add(button);

                // Create and add the topic's content
                m_SingleVisiblePanel.Add(CreateComputerInfoWidget(info));
            }

            m_SingleVisiblePanel.VisibleIndexChanged += new Function <NValueChangeEventArgs>(OnVisibleIndexValueChanged);
            m_SingleVisiblePanel.AddEventHandler(NButtonBase.ClickEvent, new NEventHandler <NEventArgs>(new Function <NEventArgs>(OnButtonClicked)));

            return(m_SingleVisiblePanel);
        }
コード例 #4
0
        protected override NWidget CreateExampleContent()
        {
            // Create the rich text
            m_RichText            = new NRichTextView();
            m_RichText.AcceptsTab = true;
            m_RichText.Content.Sections.Clear();

            NSection section = new NSection();

            section.Blocks.Add(new NParagraph("Type some content here"));
            m_RichText.Content.Sections.Add(section);

            m_RichText.Content.Layout    = ENTextLayout.Web;
            m_RichText.VScrollMode       = ENScrollMode.Never;
            m_RichText.HScrollMode       = ENScrollMode.Never;
            m_RichText.HRuler.Visibility = ENVisibility.Hidden;
            m_RichText.VRuler.Visibility = ENVisibility.Hidden;
            m_RichText.PreferredWidth    = double.NaN;
            m_RichText.PreferredHeight   = double.NaN;
            m_RichText.Border            = NBorder.CreateFilledBorder(NColor.Black);
            m_RichText.BorderThickness   = new NMargins(1);

            m_RichText.HorizontalPlacement = Layout.ENHorizontalPlacement.Fit;
            m_RichText.VerticalPlacement   = Layout.ENVerticalPlacement.Top;

            return(m_RichText);
        }
コード例 #5
0
        /// <summary>
        /// Creates a group box for the given group element or a directly a table panel if the
        /// given group element does not have a name. Group elements can contain only tile
        /// elements, label elements and other group elements.
        /// </summary>
        /// <param name="group"></param>
        /// <param name="borderColor"></param>
        /// <returns></returns>
        private NWidget CreateGroup(NXmlElement group, NColor borderColor)
        {
            // Create a table panel
            NTableFlowPanel tablePanel = CreateTablePanel(group, borderColor);

            // Get the group title
            string groupTitle = group.GetAttributeValue("name");

            if (String.IsNullOrEmpty(groupTitle))
            {
                return(tablePanel);
            }

            // Create a group box
            NLabel    headerLabel = new NLabel(groupTitle);
            NGroupBox groupBox    = new NGroupBox(headerLabel);

            groupBox.Header.HorizontalPlacement = ENHorizontalPlacement.Center;
            groupBox.Padding = new NMargins(ItemVerticalSpacing);
            groupBox.Border  = NBorder.CreateFilledBorder(borderColor);

            // Create the table panel with the examples tiles
            groupBox.Content = CreateTablePanel(group, borderColor);

            return(groupBox);
        }
コード例 #6
0
        private NTable CreateTable()
        {
            NTable table = new NTable();

            int rowCount = 3;
            int colCount = 3;

            // first create the columns
            for (int i = 0; i < colCount; i++)
            {
                table.Columns.Add(new NTableColumn());
            }

            // then add rows with cells count matching the number of columns
            for (int row = 0; row < rowCount; row++)
            {
                NTableRow tableRow = new NTableRow();
                table.Rows.Add(tableRow);

                for (int col = 0; col < colCount; col++)
                {
                    NTableCell tableCell = new NTableCell();
                    tableRow.Cells.Add(tableCell);
                    tableCell.Margins = new NMargins(4);

                    tableCell.Border          = NBorder.CreateFilledBorder(NColor.Black);
                    tableCell.BorderThickness = new NMargins(1);

                    NParagraph paragraph = new NParagraph("This is table cell [" + row.ToString() + ", " + col.ToString() + "]");
                    tableCell.Blocks.Add(paragraph);
                }
            }

            return(table);
        }
コード例 #7
0
            public override NDocumentBlock CreateDocument()
            {
                NDocumentBlock document = base.CreateDocument();

                NSection   section = document.Sections[0];
                NParagraph p       = new NParagraph("Black solid border");

                section.Blocks.Add(p);
                p.Border          = NBorder.CreateFilledBorder(NColor.Black);
                p.BorderThickness = new NMargins(1);

                p = new NParagraph("Black dashed border");
                section.Blocks.Add(p);
                p.Border = new NBorder();
                p.Border.MiddleStroke = new NStroke(5, NColor.Black, ENDashStyle.Dash);
                p.BorderThickness     = new NMargins(5);

                p = new NParagraph("Green/DarkGreen two-color border");
                section.Blocks.Add(p);
                p.Border          = NBorder.CreateTwoColorBorder(NColor.Green, NColor.DarkGreen);
                p.BorderThickness = new NMargins(10);

                p = new NParagraph("A border with left, right and bottom sides and wide but not set top side");
                section.Blocks.Add(p);
                p.Border                       = new NBorder();
                p.Border.LeftSide              = new NThreeColorsBorderSide(NColor.Black, NColor.Gray, NColor.LightGray);
                p.Border.RightSide             = new NBorderSide();
                p.Border.RightSide.OuterStroke = new NStroke(10, NColor.Blue, ENDashStyle.Dot);
                p.Border.BottomSide            = new NBorderSide(NColor.Red);
                p.BorderThickness              = new NMargins(9, 50, 5, 5);

                return(document);
            }
コード例 #8
0
ファイル: NLabelExample.cs プロジェクト: Nevron-Software/NOV
        protected override NWidget CreateExampleContent()
        {
            m_Label                 = new NLabel();
            m_Label.Border          = NBorder.CreateFilledBorder(NColor.Red);
            m_Label.BorderThickness = new NMargins(1);

            return(m_Label);
        }
コード例 #9
0
        /// <summary>
        /// Creates a table cell with border
        /// </summary>
        /// <returns></returns>
        private NTableCell CreateTableCellWithBorder()
        {
            NTableCell tableCell = new NTableCell();

            tableCell.Border          = NBorder.CreateFilledBorder(NColor.Black);
            tableCell.BorderThickness = new NMargins(1);

            return(tableCell);
        }
コード例 #10
0
        protected override void PopulateRichText()
        {
            NSection section = new NSection();

            m_RichText.Content.Sections.Add(section);

            section.Blocks.Add(GetDescriptionBlock("Table Master Cells Example", "This example shows how to programmatically create and add master cells.", 1));

            // first create the table
            NTable table = new NTable(5, 5);

            table.AllowSpacingBetweenCells = false;

            for (int row = 0; row < table.Rows.Count; row++)
            {
                for (int col = 0; col < table.Columns.Count; col++)
                {
                    NParagraph paragraph = new NParagraph("Normal Cell");

                    NTableCell tableCell = table.Rows[row].Cells[col];
                    tableCell.BorderThickness = new Nov.Graphics.NMargins(1);
                    tableCell.Border          = NBorder.CreateFilledBorder(NColor.Black);

                    // by default cells contain a single paragraph
                    tableCell.Blocks.Clear();
                    tableCell.Blocks.Add(paragraph);
                }
            }

            // set cell [0, 2] to be column master
            NTableCell colMasterCell = table.Rows[0].Cells[2];

            colMasterCell.ColSpan        = 2;
            colMasterCell.BackgroundFill = new NColorFill(ENNamedColor.LightSkyBlue);
            colMasterCell.Blocks.Clear();
            colMasterCell.Blocks.Add(new NParagraph("Column Master Cell"));

            // set cell [1, 0] to be row master
            NTableCell rowMasterCell = table.Rows[1].Cells[0];

            rowMasterCell.RowSpan        = 2;
            rowMasterCell.BackgroundFill = new NColorFill(ENNamedColor.LightSteelBlue);
            rowMasterCell.Blocks.Clear();
            rowMasterCell.Blocks.Add(new NParagraph("Row Master Cell"));

            // set cell [2, 2] to be column and row master
            NTableCell rowColMasterCell = table.Rows[2].Cells[2];

            rowColMasterCell.ColSpan        = 2;
            rowColMasterCell.RowSpan        = 2;
            rowColMasterCell.BackgroundFill = new NColorFill(ENNamedColor.MediumTurquoise);
            rowColMasterCell.Blocks.Clear();
            rowColMasterCell.Blocks.Add(new NParagraph("Row\\Col Master Cell"));

            section.Blocks.Add(table);
        }
コード例 #11
0
        protected override NWidget CreateExampleContent()
        {
            m_Barcode                 = new NMatrixBarcode();
            m_Barcode.Symbology       = ENMatrixBarcodeSymbology.QrCode;
            m_Barcode.Text            = "Nevron Software\r\n\r\nhttps://www.nevron.com";
            m_Barcode.Border          = NBorder.CreateFilledBorder(NColor.Red);
            m_Barcode.BorderThickness = new NMargins(1);

            return(m_Barcode);
        }
コード例 #12
0
        protected override NWidget CreateExampleContent()
        {
            m_Barcode                 = new NMatrixBarcode();
            m_Barcode.Symbology       = ENMatrixBarcodeSymbology.Pdf417;
            m_Barcode.Text            = "Nevron Software";
            m_Barcode.Border          = NBorder.CreateFilledBorder(NColor.Red);
            m_Barcode.BorderThickness = new NMargins(1);

            return(m_Barcode);
        }
コード例 #13
0
        protected override NWidget CreateExampleContent()
        {
            // create a dummy button
            NButton button = new NButton("I can be transformed");

            m_TransformContent = new NTransformContent(button);
            m_TransformContent.BorderThickness = new NMargins(1);
            m_TransformContent.Border          = NBorder.CreateFilledBorder(NColor.Red);
            return(m_TransformContent);
        }
コード例 #14
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Legend Appearance";

            m_Legend            = chartView.Surface.Legends[0];
            m_Legend.ExpandMode = ENLegendExpandMode.ColsFixed;
            m_Legend.ColCount   = 3;

            m_Legend.Border            = NBorder.CreateFilledBorder(NColor.Black);
            m_Legend.BorderThickness   = new NMargins(2);
            m_Legend.BackgroundFill    = new NStockGradientFill(NColor.White, NColor.LightGray);
            m_Legend.VerticalPlacement = Layout.ENVerticalPlacement.Top;

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);

            // add interlace stripe
            NLinearScale linearScale = chart.Axes[ENCartesianAxis.PrimaryY].Scale as NLinearScale;
            NScaleStrip  strip       = new NScaleStrip(new NColorFill(ENNamedColor.Beige), null, true, 0, 0, 1, 1);

            strip.Interlaced = true;
            //linearScale.Strips.Add(strip);

            // setup a bar series
            NBarSeries bar = new NBarSeries();

            bar.Name            = "Bar Series";
            bar.InflateMargins  = true;
            bar.UseXValues      = false;
            bar.LegendView.Mode = ENSeriesLegendMode.DataPoints;

            // add some data to the bar series
            bar.LegendView.Mode = ENSeriesLegendMode.DataPoints;
            bar.DataPoints.Add(new NBarDataPoint(18, "C++"));
            bar.DataPoints.Add(new NBarDataPoint(15, "Ruby"));
            bar.DataPoints.Add(new NBarDataPoint(21, "Python"));
            bar.DataPoints.Add(new NBarDataPoint(23, "Java"));
            bar.DataPoints.Add(new NBarDataPoint(27, "Javascript"));
            bar.DataPoints.Add(new NBarDataPoint(29, "C#"));
            bar.DataPoints.Add(new NBarDataPoint(26, "PHP"));
            bar.DataPoints.Add(new NBarDataPoint(17, "Objective C"));
            bar.DataPoints.Add(new NBarDataPoint(24, "SQL"));
            bar.DataPoints.Add(new NBarDataPoint(13, "Object Pascal"));
            bar.DataPoints.Add(new NBarDataPoint(19, "Visual Basic"));
            bar.DataPoints.Add(new NBarDataPoint(16, "Open Edge ABL"));

            chart.Series.Add(bar);

            return(chartView);
        }
コード例 #15
0
        protected override NWidget CreateExampleContent()
        {
            // Create an image box
            m_ImageBox                     = new NImageBox(NResources.Image_SampleImage_png);
            m_ImageBox.Border              = NBorder.CreateFilledBorder(NColor.Red);
            m_ImageBox.BorderThickness     = new NMargins(1);
            m_ImageBox.HorizontalPlacement = ENHorizontalPlacement.Left;
            m_ImageBox.VerticalPlacement   = ENVerticalPlacement.Top;

            return(m_ImageBox);
        }
コード例 #16
0
        private NContentHolder CreateDemoElement(string text)
        {
            NContentHolder element = new NContentHolder(text);

            element.Border          = NBorder.CreateFilledBorder(NColor.Black, 2, 5);
            element.BorderThickness = new NMargins(1);
            element.BackgroundFill  = new NColorFill(NColor.PapayaWhip);
            element.TextFill        = new NColorFill(NColor.Black);
            element.Padding         = new NMargins(1);
            return(element);
        }
コード例 #17
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected NParagraph CreateSampleParagraph1()
        {
            NParagraph paragraph = new NParagraph("This paragraph has margins, border thickness and padding of 10dips.");

            paragraph.Margins         = new NMargins(10);
            paragraph.BorderThickness = new NMargins(10);
            paragraph.Padding         = new NMargins(10);
            paragraph.Border          = NBorder.CreateFilledBorder(NColor.Red);
            paragraph.BackgroundFill  = new NStockGradientFill(NColor.White, NColor.LightYellow);

            return(paragraph);
        }
コード例 #18
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected NParagraph CreateFloatingParagraph(ENFloatMode floatMode)
        {
            NParagraph paragraph = new NParagraph(floatMode.ToString() + " flow paragraph.");

            paragraph.FloatMode       = floatMode;
            paragraph.PreferredWidth  = new NMultiLength(ENMultiLengthUnit.Dip, 100);
            paragraph.PreferredHeight = new NMultiLength(ENMultiLengthUnit.Dip, 100);
            paragraph.BorderThickness = new NMargins(1);
            paragraph.Border          = NBorder.CreateFilledBorder(NColor.Black);

            return(paragraph);
        }
コード例 #19
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected NParagraph CreateSampleParagraph1(string text)
        {
            NParagraph paragraph = new NParagraph(GetRepeatingText(text, 10));

            paragraph.Margins         = new NMargins(10);
            paragraph.BorderThickness = new NMargins(10);
            paragraph.Padding         = new NMargins(10);
            paragraph.Border          = NBorder.CreateFilledBorder(NColor.Red);
            paragraph.BackgroundFill  = new NStockGradientFill(NColor.White, NColor.LightYellow);

            return(paragraph);
        }
コード例 #20
0
        protected override void PopulateRichText()
        {
            NSection section = new NSection();

            m_RichText.Content.Sections.Add(section);

            section.Blocks.Add(GetDescriptionBlock("Table Cell Orientation Example", "This example shows how to programmatically modify the orientation of cells.", 1));

            // first create the table
            NTable table = new NTable(5, 5);

            table.AllowSpacingBetweenCells = false;

            for (int row = 0; row < table.Rows.Count; row++)
            {
                for (int col = 0; col < table.Columns.Count; col++)
                {
                    NParagraph paragraph = new NParagraph("Normal Cell");

                    NTableCell tableCell = table.Rows[row].Cells[col];
                    tableCell.BorderThickness = new Nov.Graphics.NMargins(1);
                    tableCell.Border          = NBorder.CreateFilledBorder(NColor.Black);

                    // by default cells contain a single paragraph
                    tableCell.Blocks.Clear();
                    tableCell.Blocks.Add(paragraph);
                }
            }

            // set cell [1, 0] to be row master
            NTableCell leftToRightCell = table.Rows[1].Cells[0];

            leftToRightCell.RowSpan        = int.MaxValue;
            leftToRightCell.BackgroundFill = new NColorFill(ENNamedColor.LightSteelBlue);
            leftToRightCell.Blocks.Clear();
            leftToRightCell.Blocks.Add(new NParagraph("Cell With Left to Right Orientation"));
            leftToRightCell.TextDirection       = ENTableCellTextDirection.LeftToRight;
            leftToRightCell.HorizontalAlignment = ENAlign.Center;
            leftToRightCell.VerticalAlignment   = ENVAlign.Center;

            // set cell [1, 0] to be row master
            NTableCell rightToLeftCell = table.Rows[1].Cells[table.Columns.Count - 1];

            rightToLeftCell.RowSpan        = int.MaxValue;
            rightToLeftCell.BackgroundFill = new NColorFill(ENNamedColor.LightGreen);
            rightToLeftCell.Blocks.Clear();
            rightToLeftCell.Blocks.Add(new NParagraph("Cell With Right to Left Orientation"));
            rightToLeftCell.TextDirection       = ENTableCellTextDirection.RightToLeft;
            rightToLeftCell.HorizontalAlignment = ENAlign.Center;
            rightToLeftCell.VerticalAlignment   = ENVAlign.Center;

            section.Blocks.Add(table);
        }
コード例 #21
0
        /// <summary>
        ///
        /// </summary>
        protected override void PopulateRichText()
        {
            m_RichText.Content.Layout     = ENTextLayout.Print;
            m_RichText.Content.ZoomFactor = 0.5;

            for (int sectionIndex = 0; sectionIndex < 4; sectionIndex++)
            {
                NSection section = new NSection();

                section.Margins = NMargins.Zero;
                section.Padding = NMargins.Zero;

                string sectionText = string.Empty;

                switch (sectionIndex)
                {
                case 0:
                    sectionText       = "Paper size A4.";
                    section.PageSize  = new NPageSize(ENPaperKind.A4);
                    section.BreakType = ENSectionBreakType.NextPage;
                    section.Blocks.Add(GetDescriptionBlock("Section Pages", "This example shows how to set different page properties, like page size, page orientation and page border", 1));
                    break;

                case 1:
                    sectionText       = "Paper size A5.";
                    section.PageSize  = new NPageSize(ENPaperKind.A5);
                    section.BreakType = ENSectionBreakType.NextPage;
                    break;

                case 2:
                    sectionText             = "Paper size A4, paper orientation portrait.";
                    section.PageOrientation = ENPageOrientation.Landscape;
                    section.PageSize        = new NPageSize(ENPaperKind.A4);
                    section.BreakType       = ENSectionBreakType.NextPage;
                    break;

                case 3:
                    sectionText                 = "Paper size A4, page border solid 10dip.";
                    section.PageBorder          = NBorder.CreateFilledBorder(NColor.Black);
                    section.PageBorderThickness = new NMargins(10);
                    section.PageSize            = new NPageSize(ENPaperKind.A4);
                    section.BreakType           = ENSectionBreakType.NextPage;
                    break;
                }

                m_RichText.Content.Sections.Add(section);

                // add some content
                NParagraph paragraph = new NParagraph(sectionText);
                section.Blocks.Add(paragraph);
            }
        }
コード例 #22
0
        protected override NWidget CreateExampleContent()
        {
            m_WrapFlowPanel                 = new NWrapFlowPanel();
            m_WrapFlowPanel.Border          = NBorder.CreateFilledBorder(NColor.Red);
            m_WrapFlowPanel.BorderThickness = new NMargins(1);

            for (int i = 1; i <= 16; i++)
            {
                m_WrapFlowPanel.Add(new NButton("Button " + i.ToString()));
            }

            return(m_WrapFlowPanel);
        }
コード例 #23
0
        /// <summary>
        /// Creates the default docked widget for this example, that is docked to the specified area.
        /// </summary>
        /// <param name="dockArea"></param>
        /// <returns></returns>
        private NWidget CreateDockedWidget(ENDockArea dockArea)
        {
            NLabel label = new NLabel(dockArea.ToString() + "(" + m_DockPanel.Count.ToString() + ")");

            label.HorizontalPlacement = ENHorizontalPlacement.Center;
            label.VerticalPlacement   = ENVerticalPlacement.Center;

            NWidget widget = new NContentHolder(label);

            widget.Border          = NBorder.CreateFilledBorder(NColor.Black);
            widget.BorderThickness = new NMargins(1);
            SetDockArea(widget, dockArea);
            return(widget);
        }
コード例 #24
0
        /// <summary>
        /// Creates the bracket of a license group.
        /// </summary>
        /// <param name="color"></param>
        /// <returns></returns>
        private NWidget CreateLicenseGroupBracket(NColor color)
        {
            NWidget bracket = new NWidget();

            bracket.BackgroundFill = new NStockGradientFill(ENGradientStyle.Horizontal,
                                                            ENGradientVariant.Variant1, new NColor(NColor.White, 128), NColor.White);
            bracket.Border          = NBorder.CreateFilledBorder(color);
            bracket.BorderThickness = new NMargins(1, 0, 1, 1);
            bracket.PreferredHeight = IconSpacing / 2;
            bracket.Padding         = new NMargins(0, NDesign.VerticalSpacing);
            bracket.Margins         = new NMargins(IconSpacing / 4, 0);

            return(bracket);
        }
コード例 #25
0
        private NWidget CreateBoxContent(string text, NColor borderColor)
        {
            NLabel label = new NLabel(text);

            label.HorizontalPlacement = ENHorizontalPlacement.Center;
            label.VerticalPlacement   = ENVerticalPlacement.Center;

            NContentHolder contentElement = new NContentHolder(label);

            contentElement.Border          = NBorder.CreateFilledBorder(borderColor);
            contentElement.BorderThickness = new NMargins(1);
            contentElement.Padding         = new NMargins(2);

            return(contentElement);
        }
コード例 #26
0
        private NTableBlock CreateTableBlock(string description)
        {
            NTableBlock tableBlock = new NTableBlock(4, 3, NBorder.CreateFilledBorder(NColor.Black), new NMargins(1));

            NTableBlockContent tableBlockContent = tableBlock.Content;

            NTableCell tableCell = tableBlock.Content.Rows[0].Cells[0];

            tableCell.ColSpan = int.MaxValue;

            tableCell.Blocks.Clear();
            NParagraph par = new NParagraph(description);

            par.FontStyleBold = true;
            tableCell.Blocks.Add(par);

            for (int rowIndex = 1; rowIndex < tableBlockContent.Rows.Count; rowIndex++)
            {
                NTableRow row = tableBlockContent.Rows[rowIndex];

                for (int colIndex = 0; colIndex < tableBlockContent.Columns.Count; colIndex++)
                {
                    NTableCell cell = row.Cells[colIndex];

                    cell.Blocks.Clear();
                    cell.Blocks.Add(new NParagraph("This is table cell [" + rowIndex.ToString() + ", " + colIndex.ToString() + "]"));
                }
            }

            NTableCellIterator iter = new NTableCellIterator(tableBlockContent);

            while (iter.MoveNext())
            {
                iter.Current.VerticalAlignment   = ENVAlign.Center;
                iter.Current.HorizontalAlignment = ENAlign.Center;
            }

            // make sure all columns are percentage based
            double percent = 100 / tableBlockContent.Columns.Count;

            for (int i = 0; i < tableBlockContent.Columns.Count; i++)
            {
                tableBlockContent.Columns[i].PreferredWidth = new Nevron.Nov.NMultiLength(Nevron.Nov.ENMultiLengthUnit.Percentage, percent);
            }

            return(tableBlock);
        }
コード例 #27
0
        private NWidget CreateRTFDemo()
        {
            NStackPanel stack = new NStackPanel();

            stack.FillMode = ENStackFillMode.Last;
            stack.FitMode  = ENStackFitMode.Last;

            NButton setButton = new NButton("Set Clipboard RTF");

            setButton.Click += new Function <NEventArgs>(OnSetRTFButtonClick);

            NButton getButton = new NButton("Get Clipboard RTF");

            getButton.Click += new Function <NEventArgs>(OnGetRTFButtonClick);

            NPairBox pairBox = new NPairBox(setButton, getButton);

            pairBox.HorizontalPlacement = ENHorizontalPlacement.Left;
            pairBox.Spacing             = NDesign.HorizontalSpacing;
            stack.Add(pairBox);

            // Create a rich text view and some content
            m_RichText = new NRichTextView();
            m_RichText.PreferredSize = new NSize(400, 300);

            NSection section = new NSection();

            m_RichText.Content.Sections.Add(section);

            NTable table = new NTable(2, 2);

            table.AllowSpacingBetweenCells = false;

            section.Blocks.Add(table);
            for (int i = 0; i < 4; i++)
            {
                NTableCell cell = table.Rows[i / 2].Cells[i % 2];
                cell.Border          = NBorder.CreateFilledBorder(NColor.Black);
                cell.BorderThickness = new NMargins(1);
                NParagraph paragraph = (NParagraph)cell.Blocks[0];
                paragraph.Inlines.Add(new NTextInline("Cell " + (i + 1).ToString(CultureInfo.InvariantCulture)));
            }

            stack.Add(m_RichText);
            return(stack);
        }
コード例 #28
0
        protected override NWidget CreateExampleContent()
        {
            // Create a multi splitter
            m_MultiSplitter = new NMultiSplitter();

            NSplitterPane pane1 = new NSplitterPane();

            pane1.Padding         = new NMargins(NDesign.HorizontalSpacing, NDesign.VerticalSpacing);
            pane1.BackgroundFill  = new NColorFill(NColor.LightGreen);
            pane1.Border          = NBorder.CreateFilledBorder(NColor.Black);
            pane1.BorderThickness = new NMargins(1);
            pane1.Content         = new NLabel("Pane 1");
            m_MultiSplitter.Widgets.Add(pane1);

            NSplitterThumb thumb1 = new NSplitterThumb();

            thumb1.CollapseMode = ENSplitterCollapseMode.BothPanes;
            m_MultiSplitter.Widgets.Add(thumb1);

            NSplitterPane pane2 = new NSplitterPane();

            pane2.Padding         = new NMargins(NDesign.HorizontalSpacing, NDesign.VerticalSpacing);
            pane2.BackgroundFill  = new NColorFill(NColor.LightBlue);
            pane2.Border          = NBorder.CreateFilledBorder(NColor.Black);
            pane2.BorderThickness = new NMargins(1);
            pane2.Content         = new NLabel("Pane 2");
            m_MultiSplitter.Widgets.Add(pane2);

            NSplitterThumb thumb2 = new NSplitterThumb();

            thumb2.CollapseMode = ENSplitterCollapseMode.BothPanes;
            m_MultiSplitter.Widgets.Add(thumb2);

            NSplitterPane pane3 = new NSplitterPane();

            pane3.Padding         = new NMargins(NDesign.HorizontalSpacing, NDesign.VerticalSpacing);
            pane3.BackgroundFill  = new NColorFill(NColor.LightYellow);
            pane3.Border          = NBorder.CreateFilledBorder(NColor.Black);
            pane3.BorderThickness = new NMargins(1);
            pane3.Content         = new NLabel("Pane 3");
            m_MultiSplitter.Widgets.Add(pane3);

            return(m_MultiSplitter);
        }
コード例 #29
0
            private static void InitCell(NTableCell cell, int rowSpan, int colSpan, string text)
            {
                if (rowSpan != 1)
                {
                    cell.RowSpan = rowSpan;
                }

                if (colSpan != 1)
                {
                    cell.ColSpan = colSpan;
                }

                // By default cells contain a single paragraph
                cell.Blocks.Clear();
                cell.Blocks.Add(new NParagraph(text));

                // Create a border
                cell.Border          = NBorder.CreateFilledBorder(NColor.Black);
                cell.BorderThickness = new NMargins(1);
            }
コード例 #30
0
        protected override NWidget CreateExampleContent()
        {
            m_Label = new NLabel("Click me with the right mouse button");
            m_Label.HorizontalPlacement = ENHorizontalPlacement.Center;
            m_Label.VerticalPlacement   = ENVerticalPlacement.Center;
            m_Label.Font     = new NFont(NFontDescriptor.DefaultSansFamilyName, 10, ENFontStyle.Regular);
            m_Label.TextFill = new NColorFill(NColor.Black);

            NContentHolder widget = new NContentHolder(m_Label);

            widget.HorizontalPlacement = ENHorizontalPlacement.Left;
            widget.VerticalPlacement   = ENVerticalPlacement.Top;
            widget.BackgroundFill      = new NColorFill(NColor.PapayaWhip);
            widget.Border          = NBorder.CreateFilledBorder(NColor.Black);
            widget.BorderThickness = new NMargins(1);
            widget.PreferredSize   = new NSize(300, 100);
            widget.MouseDown      += new Function <NMouseButtonEventArgs>(OnTargetWidgetMouseDown);

            return(widget);
        }