예제 #1
0
        protected override NWidget CreateExampleContent()
        {
            m_PathAngle     = 0;
            m_PathPositionX = 200;
            m_PathPositionY = 100;

            m_Stroke = new NStroke(1, NColor.Red);

            // create an image fill using an embedded image
            m_ImageFill = new NImageFill(NResources.Image_Artistic_Plane_png);

            // create a custom texture mapping and assign it to the image fill
            m_MyTextureMapping = new MyTextureMapping();
            m_MyTextureMapping.TextureAngle = 45;
            m_MyTextureMapping.PinPoint     = new NPoint(m_PathPositionX, m_PathPositionY);
            m_ImageFill.TextureMapping      = m_MyTextureMapping;

            m_Canvas = new NCanvas();
            m_Canvas.PreferredSize       = new NSize(800, 600);
            m_Canvas.BackgroundFill      = new NColorFill(new NColor(220, 220, 200));
            m_Canvas.HorizontalPlacement = ENHorizontalPlacement.Center;
            m_Canvas.VerticalPlacement   = ENVerticalPlacement.Center;
            m_Canvas.PrePaint           += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint);

            NScrollContent scroll = new NScrollContent();

            scroll.Content        = m_Canvas;
            scroll.NoScrollHAlign = ENNoScrollHAlign.Center;
            scroll.NoScrollVAlign = ENNoScrollVAlign.Center;
            return(scroll);
        }
예제 #2
0
        protected override NWidget CreateExampleContent()
        {
            m_Shadow = new NShadow(new NColor(160, 160, 160), 20, 20);

            string[] names = new string[]
            {
                "Line", "Polyline", "Rectangle", "Ellipse", "Triangle", "Quad", "Polygon", "Graphics Path"
            };

            PaintPrimitiveDelegate[] delegates = new PaintPrimitiveDelegate[]
            {
                new PaintPrimitiveDelegate(PaintLine),
                new PaintPrimitiveDelegate(PaintPolyline),
                new PaintPrimitiveDelegate(PaintRectangle),
                new PaintPrimitiveDelegate(PaintEllipse),
                new PaintPrimitiveDelegate(PaintTriangle),
                new PaintPrimitiveDelegate(PaintQuadrangle),
                new PaintPrimitiveDelegate(PaintPolygon),
                new PaintPrimitiveDelegate(PaintPath),
            };

            int count = delegates.Length;

            // Create a table panel to hold the canvases and the labels
            m_Table = new NTableFlowPanel();
            m_Table.HorizontalPlacement = ENHorizontalPlacement.Left;
            m_Table.VerticalPlacement   = ENVerticalPlacement.Top;
            m_Table.Padding             = new NMargins(30);
            m_Table.HorizontalSpacing   = 30;
            m_Table.VerticalSpacing     = 30;
            m_Table.MaxOrdinal          = 4;

            for (int i = 0; i < count; i++)
            {
                NStackPanel stack = new NStackPanel();
                m_Table.Add(stack);
                stack.VerticalSpacing = 5;

                // Create a canvas to draw in
                NCanvas canvas = new NCanvas();
                canvas.PreferredSize  = new NSize(defaultCanvasWidth, defaultCanvasHeight);
                canvas.Tag            = delegates[i];
                canvas.BackgroundFill = new NColorFill(NColor.White);
                canvas.PrePaint      += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint);
                stack.Add(canvas);

                // Create a label for the geometry primitive's name
                NLabel label = new NLabel(names[i]);
                label.HorizontalPlacement = ENHorizontalPlacement.Center;
                stack.Add(label);
            }

            // The table must be scrollable
            NScrollContent scroll = new NScrollContent();

            scroll.Content = m_Table;
            return(scroll);
        }
        protected override NWidget CreateExampleContent()
        {
            // Create a table panel to hold the canvases and the labels
            m_Table = new NTableFlowPanel();
            m_Table.HorizontalPlacement = ENHorizontalPlacement.Left;
            m_Table.VerticalPlacement   = ENVerticalPlacement.Top;
            m_Table.Padding             = new NMargins(30);
            m_Table.HorizontalSpacing   = 30;
            m_Table.VerticalSpacing     = 30;
            m_Table.MaxOrdinal          = 2;

            string[] texts = new string[]
            {
                "Two Gradient Stops, Horizontal Gradient Axis",
                "Five Gradient Stops, Vertical Gradient Axis",
                "Gradient Axis Angle = 45deg, Mapping Mode = ZoomToFill",
                "Gradient Axis Angle = 45deg, Mapping Mode = Stretch"
            };

            NLinearGradientFill[] fills = new NLinearGradientFill[]
            {
                GradientWithTwoStops(),
                GradientWithFiveStops(),
                GradientInZoomToFillMode(),
                GradientInStretchMode(),
            };

            // Add a canvas for each demonstrated gradient
            for (int i = 0; i < fills.Length; i++)
            {
                NStackPanel stack = new NStackPanel();
                m_Table.Add(stack);
                stack.Direction = ENHVDirection.TopToBottom;
                stack.FillMode  = ENStackFillMode.First;
                stack.FitMode   = ENStackFitMode.First;

                // Create a widget with the proper filling
                NCanvas canvas = new NCanvas();
                canvas.PreferredSize = new NSize(defaultCanvasWidth, defaultCanvasHeight);
                canvas.Tag           = fills[i];
                stack.Add(canvas);
                canvas.PrePaint += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint);

                // Create a label with the corresponding name
                NLabel label = new NLabel(texts[i]);
                stack.Add(label);
                label.HorizontalPlacement = ENHorizontalPlacement.Center;
            }

            // The table must be scrollable
            NScrollContent scroll = new NScrollContent();

            scroll.Content = m_Table;
            return(scroll);
        }
예제 #4
0
        protected override NWidget CreateExampleContent()
        {
            double width = 1;
            NColor color = NColor.Black;

            m_arrStrokes = new NStroke[]
            {
                new NStroke(width, color, ENDashStyle.Solid),
                new NStroke(width, color, ENDashStyle.Dot),
                new NStroke(width, color, ENDashStyle.Dash),
                new NStroke(width, color, ENDashStyle.DashDot),
                new NStroke(width, color, ENDashStyle.DashDotDot),
                new NStroke(width, color, new NDashPattern(2, 2, 2, 2, 0, 2))
            };

            m_EditStroke          = new NStroke();
            m_EditStroke.Width    = width;
            m_EditStroke.Color    = color;
            m_EditStroke.DashCap  = ENLineCap.Square;
            m_EditStroke.StartCap = ENLineCap.Square;
            m_EditStroke.EndCap   = ENLineCap.Square;

            for (int i = 0; i < m_arrStrokes.Length; i++)
            {
                NStroke stroke = m_arrStrokes[i];
                stroke.DashCap  = m_EditStroke.DashCap;
                stroke.StartCap = m_EditStroke.StartCap;
                stroke.EndCap   = m_EditStroke.EndCap;
            }

            m_LabelFont = new NFont(NFontDescriptor.DefaultSansFamilyName, 12, ENFontStyle.Bold);
            m_LabelFill = new NColorFill(ENNamedColor.Black);

            m_CanvasStack          = new NStackPanel();
            m_CanvasStack.FillMode = ENStackFillMode.None;
            m_CanvasStack.FitMode  = ENStackFitMode.None;

            NSize preferredSize = GetCanvasPreferredSize(m_EditStroke.Width);

            for (int i = 0; i < m_arrStrokes.Length; i++)
            {
                NCanvas canvas = new NCanvas();
                canvas.PrePaint      += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint);
                canvas.PreferredSize  = preferredSize;
                canvas.Tag            = m_arrStrokes[i];
                canvas.BackgroundFill = new NColorFill(NColor.White);
                m_CanvasStack.Add(canvas);
            }

            // The stack must be scrollable
            NScrollContent scroll = new NScrollContent();

            scroll.Content = m_CanvasStack;
            return(scroll);
        }
예제 #5
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public NExamplesHomePage()
        {
            // Apply a Windows 8 theme
            Document.InheritStyleSheets = false;
            NUITheme theme = new NWindows8Theme();

            Document.StyleSheets.ApplyTheme(theme);
            m_ExamplesMap = null;

            // Add some custom styles
            Document.StyleSheets.Add(CreateCustomStyleSheet(theme));

            // Load the metafile images
            Stream emfStream = NResources.Instance.GetResourceStream("RBIN_HomePageEmfs_zip");

            m_EmfDecompressor = new NEmfDecompressor();
            NCompression.DecompressZip(emfStream, m_EmfDecompressor);

            // Create the main dock panel
            m_MainPanel = new NDockPanel();
            m_MainPanel.HorizontalSpacing   = GroupHorizontalSpacing;
            m_MainPanel.VerticalSpacing     = GroupVerticalSpacing;
            m_MainPanel.Padding             = new NMargins(GroupHorizontalSpacing, GroupVerticalSpacing);
            m_MainPanel.HorizontalPlacement = ENHorizontalPlacement.Center;
            m_MainPanel.VerticalPlacement   = ENVerticalPlacement.Center;

            // Create the contacts and the header labels
            m_MainPanel.Add(CreateSearchAndContacts(), ENDockArea.Top);
            m_HeaderLabel = CreateHeader();
            m_MainPanel.Add(m_HeaderLabel, ENDockArea.Top);

            // Create the page panel
            m_PagePanel = new NSingleVisiblePanel();
            m_PagePanel.Add(CreateWelcomePanel());
            m_MainPanel.Add(m_PagePanel, ENDockArea.Center);

            // Place the main panel in a scroll content
            NScrollContent scrollContent = new NScrollContent(m_MainPanel);

            scrollContent.WindowBackgroundFill = new NColorFill(BackgroundColor);
            scrollContent.NoScrollHAlign       = ENNoScrollHAlign.Center;
            scrollContent.NoScrollVAlign       = ENNoScrollVAlign.Center;
            scrollContent.HorizontalPlacement  = ENHorizontalPlacement.Fit;
            scrollContent.VerticalPlacement    = ENVerticalPlacement.Fit;
            scrollContent.Border          = null;
            scrollContent.BorderThickness = NMargins.Zero;

            // Place the scroll content in a document box surface to prevent theme style inheritance
            NDocumentBoxSurface surface = new NDocumentBoxSurface(scrollContent);

            surface.TextFill = new NColorFill(TextColor);
            Document.Content = surface;
        }
예제 #6
0
        protected override NWidget CreateExampleContent()
        {
            m_SymbolsTable = new NTableFlowPanel();
            m_SymbolsTable.BackgroundFill    = new NColorFill(NColor.White);
            m_SymbolsTable.HorizontalSpacing = NDesign.HorizontalSpacing * 3;
            m_SymbolsTable.VerticalSpacing   = NDesign.VerticalSpacing * 3;
            m_SymbolsTable.Direction         = ENHVDirection.LeftToRight;
            m_SymbolsTable.MaxOrdinal        = 4;
            m_SymbolsTable.Padding           = new NMargins(NDesign.HorizontalSpacing, NDesign.VerticalSpacing,
                                                            NDesign.HorizontalSpacing * 6, NDesign.VerticalSpacing);

            NScrollContent scrollContent = new NScrollContent(m_SymbolsTable);

            scrollContent.HorizontalPlacement = ENHorizontalPlacement.Left;
            return(scrollContent);
        }
예제 #7
0
        protected override NWidget CreateExampleContent()
        {
            m_Canvas = new NCanvas();
            m_Canvas.PreferredSize  = new NSize(W, H);
            m_Canvas.BackgroundFill = new NHatchFill(ENHatchStyle.LargeCheckerBoard, NColor.LightGray, NColor.White);
            m_Canvas.PrePaint      += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint);

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

            NScrollContent scroll = new NScrollContent();

            scroll.Content        = m_Canvas;
            scroll.NoScrollHAlign = ENNoScrollHAlign.Center;
            scroll.NoScrollVAlign = ENNoScrollVAlign.Center;
            return(scroll);
        }
예제 #8
0
        protected override NWidget CreateExampleContent()
        {
            m_InputPaths = new NList <NGraphicsPath>();
            m_OutputPath = new NGraphicsPath();

            m_Canvas = new NCanvas();
            m_Canvas.HorizontalPlacement = ENHorizontalPlacement.Fit;
            m_Canvas.VerticalPlacement   = ENVerticalPlacement.Fit;
            m_Canvas.PrePaint           += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint);
            m_Canvas.BackgroundFill      = new NColorFill(NColor.White);

            NScrollContent scrollContent = new NScrollContent();

            scrollContent.Content = m_Canvas;

            return(scrollContent);
        }
        protected override NWidget CreateExampleContent()
        {
            // Create the gradient fills
            NFill[]  fills;
            string[] texts;

            int columnCount = CreateFillsAndDescriptions(out fills, out texts);

            // Create a table panel to hold the canvases and the labels
            m_Table = new NTableFlowPanel();
            m_Table.HorizontalPlacement = ENHorizontalPlacement.Left;
            m_Table.VerticalPlacement   = ENVerticalPlacement.Top;
            m_Table.Padding             = new NMargins(30);
            m_Table.HorizontalSpacing   = 30;
            m_Table.VerticalSpacing     = 30;
            m_Table.MaxOrdinal          = columnCount;

            for (int i = 0; i < fills.Length; i++)
            {
                NStackPanel stack = new NStackPanel();
                m_Table.Add(stack);
                stack.Direction = ENHVDirection.TopToBottom;
                stack.FillMode  = ENStackFillMode.First;
                stack.FitMode   = ENStackFitMode.First;

                // Create a widget with the proper filling
                NCanvas canvas = new NCanvas();
                canvas.PreferredSize = new NSize(defaultCanvasWidth, defaultCanvasHeight);
                canvas.Tag           = fills[i];
                stack.Add(canvas);
                canvas.PrePaint += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint);

                // Create a label with the corresponding name
                NLabel label = new NLabel(texts[i]);
                stack.Add(label);
                label.HorizontalPlacement = ENHorizontalPlacement.Center;
            }

            // The table must be scrollable
            NScrollContent scroll = new NScrollContent();

            scroll.Content = m_Table;
            return(scroll);
        }
예제 #10
0
        protected override NWidget CreateExampleContent()
        {
            // Get the fill styles
            ENHatchStyle[] hatches = NEnum.GetValues <ENHatchStyle>();
            int            count   = hatches.Length;

            // Create a table layout panel
            m_Table = new NTableFlowPanel();
            m_Table.HorizontalPlacement = ENHorizontalPlacement.Left;
            m_Table.VerticalPlacement   = ENVerticalPlacement.Top;
            m_Table.Padding             = new NMargins(30);
            m_Table.HorizontalSpacing   = 30;
            m_Table.VerticalSpacing     = 30;
            m_Table.MaxOrdinal          = 6;

            // Add widgets with the proper filling and names to the panel

            for (int i = 0; i < count; i++)
            {
                NStackPanel stack = new NStackPanel();
                m_Table.Add(stack);
                stack.Direction = ENHVDirection.TopToBottom;
                stack.FillMode  = ENStackFillMode.First;
                stack.FitMode   = ENStackFitMode.First;

                // Create a widget with the proper filling
                NCanvas canvas = new NCanvas();
                canvas.PreferredSize = new NSize(defaultCanvasWidth, defaultCanvasHeight);
                canvas.Tag           = new NHatchFill(hatches[i], defaultForegroundColor, defaultBackgroundColor);
                stack.Add(canvas);
                canvas.PrePaint += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint);

                // Create a label with the corresponding name
                NLabel label = new NLabel(hatches[i].ToString());
                stack.Add(label);
                label.HorizontalPlacement = ENHorizontalPlacement.Center;
            }

            // The table must be scrollable
            NScrollContent scroll = new NScrollContent();

            scroll.Content = m_Table;
            return(scroll);
        }
예제 #11
0
        protected override NWidget CreateExampleContent()
        {
            m_ScrollContent = new NScrollContent();
            m_ScrollContent.HorizontalPlacement = ENHorizontalPlacement.Left;
            m_ScrollContent.VerticalPlacement   = ENVerticalPlacement.Top;
            m_ScrollContent.Border          = NBorder.CreateFilledBorder(NColor.Red);
            m_ScrollContent.BorderThickness = new NMargins(1);
            m_ScrollContent.PreferredSize   = new NSize(300, 250);

            // Create a table with some buttons
            NTableFlowPanel table = new NTableFlowPanel();

            table.MaxOrdinal = 10;
            for (int i = 1; i <= 150; i++)
            {
                table.Add(new NButton("Button " + i.ToString()));
            }

            m_ScrollContent.Content = table;
            return(m_ScrollContent);
        }
        protected override NWidget CreateExampleContent()
        {
            // Create a table panel to hold the canvases and the labels
            m_Table = new NTableFlowPanel();
            m_Table.HorizontalPlacement = ENHorizontalPlacement.Left;
            m_Table.VerticalPlacement   = ENVerticalPlacement.Top;
            m_Table.Padding             = new NMargins(30);
            m_Table.HorizontalSpacing   = 30;
            m_Table.VerticalSpacing     = 30;
            m_Table.MaxOrdinal          = 4;

            ENAdvancedGradientColorScheme[] predefinedGradientSchemes = NEnum.GetValues <ENAdvancedGradientColorScheme>();

            for (int i = 0; i < predefinedGradientSchemes.Length; i++)
            {
                NStackPanel stack = new NStackPanel();
                m_Table.Add(stack);
                stack.Direction = ENHVDirection.TopToBottom;
                stack.FillMode  = ENStackFillMode.First;
                stack.FitMode   = ENStackFitMode.First;

                // Create a widget with the proper filling
                NCanvas canvas = new NCanvas();
                canvas.PreferredSize = new NSize(defaultCanvasWidth, defaultCanvasHeight);
                canvas.Tag           = NAdvancedGradientFill.Create(predefinedGradientSchemes[i], 0);
                stack.Add(canvas);
                canvas.PrePaint += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint);

                // Create a label with the corresponding name
                NLabel label = new NLabel(predefinedGradientSchemes[i].ToString());
                stack.Add(label);
                label.HorizontalPlacement = ENHorizontalPlacement.Center;
            }

            // The table must be scrollable
            NScrollContent scroll = new NScrollContent();

            scroll.Content = m_Table;
            return(scroll);
        }
예제 #13
0
        protected override NWidget CreateExampleContent()
        {
            m_PaintImageInRectangle = false;
            m_PosX   = 10;
            m_PosY   = 10;
            m_Width  = 200;
            m_Height = 200;

            m_Canvas = new NCanvas();
            m_Canvas.PreferredSize       = new NSize(800, 600);
            m_Canvas.BackgroundFill      = new NColorFill(new NColor(220, 220, 200));
            m_Canvas.HorizontalPlacement = ENHorizontalPlacement.Center;
            m_Canvas.VerticalPlacement   = ENVerticalPlacement.Center;
            m_Canvas.PrePaint           += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint);

            NScrollContent scroll = new NScrollContent();

            scroll.Content        = m_Canvas;
            scroll.NoScrollHAlign = ENNoScrollHAlign.Center;
            scroll.NoScrollVAlign = ENNoScrollVAlign.Center;
            return(scroll);
        }
예제 #14
0
        protected override NWidget CreateExampleContent()
        {
            m_PositionX = 100;
            m_PositionY = 220;
            m_Angle1    = -50;
            m_Angle2    = 40;
            m_Angle3    = 90;
            m_ClipRect  = new NRectangle(20, 20, 500, 360);

            m_Canvas = new NCanvas();
            m_Canvas.PreferredSize       = new NSize(600, 400);
            m_Canvas.BackgroundFill      = new NColorFill(new NColor(220, 220, 200));
            m_Canvas.HorizontalPlacement = ENHorizontalPlacement.Center;
            m_Canvas.VerticalPlacement   = ENVerticalPlacement.Center;
            m_Canvas.PrePaint           += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint);

            NScrollContent scroll = new NScrollContent();

            scroll.Content        = m_Canvas;
            scroll.NoScrollHAlign = ENNoScrollHAlign.Center;
            scroll.NoScrollVAlign = ENNoScrollVAlign.Center;
            return(scroll);
        }
예제 #15
0
        protected override NWidget CreateExampleContent()
        {
            NList <string> imageNames = NImageDecodingExampleHelper.GetImageNames("GifSuite", "gif");

            NTableFlowPanel table = new NTableFlowPanel();

            table.HorizontalPlacement = ENHorizontalPlacement.Left;
            table.VerticalPlacement   = ENVerticalPlacement.Top;
            table.Padding             = new NMargins(30);
            table.HorizontalSpacing   = 30;
            table.VerticalSpacing     = 30;
            table.MaxOrdinal          = 2;

            int rowCount = imageNames.Count;

            for (int i = 0; i < rowCount; i++)
            {
                NLabel nameLabel = new NLabel(imageNames[i]);
                nameLabel.MaxWidth = 200;

                NEmbeddedResourceImageSource imgSrc = new NEmbeddedResourceImageSource(new NEmbeddedResourceRef(NResources.Instance, imageNames[i]));
                imgSrc.AnimateFrames = true;

                NImageBox novImageBox = new NImageBox(new NImage(imgSrc));
                novImageBox.ImageMapping = new NAlignTextureMapping(ENHorizontalAlignment.Center, ENVerticalAlignment.Center);

                table.Add(nameLabel);
                table.Add(novImageBox);
            }

            // The table must be scrollable
            NScrollContent scroll = new NScrollContent();

            scroll.Content = table;
            return(scroll);
        }
        protected override NWidget CreateExampleContent()
        {
            // Create a table panel to hold the canvases and the labels
            m_Table = new NTableFlowPanel();
            m_Table.HorizontalPlacement = ENHorizontalPlacement.Left;
            m_Table.VerticalPlacement   = ENVerticalPlacement.Top;
            m_Table.Padding             = new NMargins(30);
            m_Table.HorizontalSpacing   = 30;
            m_Table.VerticalSpacing     = 30;
            m_Table.MaxOrdinal          = 4;

            string[] names = new string[]
            {
                "Rectangle",
                "Rounded Rectangle",
                "Ellipse",
                "Ellipse Segment",
                "Elliptical Arc",
                "Pie",
                "Circle",
                "Circle Segment",
                "Triangle",
                "Quad",
                "Polygon",
                "Line Segment",
                "Polyline",
                "Cubic Bezier",
                "Nurbs Curve",
                "Path with Multiple Figures"
            };

            NGraphicsPath[] paths = CreatePaths(defaultCanvasWidth, defaultCanvasHeight);

            int count = paths.Length;

            for (int i = 0; i < count; i++)
            {
                NStackPanel stack = new NStackPanel();
                m_Table.Add(stack);
                stack.VerticalSpacing = 5;

                // Create a canvas to draw the graphics path in
                NCanvas canvas = new NCanvas();
                canvas.PreferredSize  = new NSize(defaultCanvasWidth, defaultCanvasHeight);
                canvas.Tag            = paths[i];
                canvas.PrePaint      += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint);
                canvas.BackgroundFill = new NColorFill(NColor.LightGreen);
                stack.Add(canvas);

                // Create a label for the geometry primitive's name
                NLabel label = new NLabel(names[i]);
                label.HorizontalPlacement = ENHorizontalPlacement.Center;
                stack.Add(label);
            }

            // The table must be scrollable
            NScrollContent scroll = new NScrollContent();

            scroll.Content = m_Table;
            return(scroll);
        }
예제 #17
0
        private NWidget CreateRasterDemo()
        {
            NStackPanel rasterStack = new NStackPanel();

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

            // create the controls that demonstrate how to place image content on the clipboard
            {
                NGroupBox setRastersGroupBox = new NGroupBox("Setting images on the clipboard");
                rasterStack.Add(setRastersGroupBox);

                NStackPanel setRastersStack = new NStackPanel();
                setRastersStack.Direction  = ENHVDirection.LeftToRight;
                setRastersGroupBox.Content = setRastersStack;

                for (int i = 0; i < 3; i++)
                {
                    NPairBox pair = new NPairBox();

                    switch (i)
                    {
                    case 0:
                        pair.Box1 = new NImageBox(NResources.Image__48x48_Book_png);
                        break;

                    case 1:
                        pair.Box1 = new NImageBox(NResources.Image__48x48_Clock_png);
                        break;

                    case 2:
                        pair.Box1 = new NImageBox(NResources.Image__48x48_Darts_png);
                        break;
                    }

                    pair.Box2 = new NLabel("Set me on the clipboard");
                    pair.Box2.HorizontalPlacement = ENHorizontalPlacement.Center;
                    pair.BoxesRelation            = ENPairBoxRelation.Box1AboveBox2;

                    NButton setRasterButton = new NButton(pair);
                    setRasterButton.Tag    = i;
                    setRasterButton.Click += new Function <NEventArgs>(OnSetRasterButtonClick);
                    setRastersStack.Add(setRasterButton);
                }
            }

            // create the controls that demonstrate how to get image content from the clipboard
            {
                NGroupBox getRastersGroupBox = new NGroupBox("Getting images from the clipboard");
                rasterStack.Add(getRastersGroupBox);

                NStackPanel getRastersStack = new NStackPanel();
                getRastersStack.FillMode   = ENStackFillMode.Last;
                getRastersStack.FitMode    = ENStackFitMode.Last;
                getRastersGroupBox.Content = getRastersStack;

                m_ImageBox                 = new NImageBox();
                m_ImageBox.Margins         = new NMargins(10);
                m_ImageBox.Border          = NBorder.CreateFilledBorder(NColor.Black);
                m_ImageBox.BorderThickness = new NMargins(1);
                m_ImageBox.Visibility      = ENVisibility.Hidden;

                NButton getRasterButton = new NButton("Get image from the clipboard");
                getRasterButton.HorizontalPlacement = ENHorizontalPlacement.Left;
                getRasterButton.Click += new Function <NEventArgs>(OnGetRasterButtonClick);
                getRastersStack.Add(getRasterButton);

                NScrollContent scrollContent = new NScrollContent();
                scrollContent.BackgroundFill = new NHatchFill(ENHatchStyle.LargeCheckerBoard, NColor.Gray, NColor.LightGray);
                scrollContent.Content        = m_ImageBox;
                scrollContent.NoScrollHAlign = ENNoScrollHAlign.Left;
                scrollContent.NoScrollVAlign = ENNoScrollVAlign.Top;
                getRastersStack.Add(scrollContent);
            }

            return(rasterStack);
        }
예제 #18
0
        protected override NWidget CreateExampleContent()
        {
            string[] colHeadings = new string[]
            {
                "Image",
                "Description",
                "Decoded with NOV Decoders",
                "Decoded with Native Decoders"
            };

            int colCount = colHeadings.Length;

            NTableFlowPanel table = new NTableFlowPanel();

            table.HorizontalPlacement = ENHorizontalPlacement.Left;
            table.VerticalPlacement   = ENVerticalPlacement.Top;
            table.Padding             = new NMargins(30);
            table.HorizontalSpacing   = 30;
            table.VerticalSpacing     = 30;
            table.MaxOrdinal          = colCount;

            NList <string>        imageNames   = NImageDecodingExampleHelper.GetImageNames("JpegSuite", "jpg");
            NMap <string, string> descriptions = NImageDecodingExampleHelper.LoadDescriptions(NResources.String_JpegSuite_txt);

            for (int i = 0; i < colCount; i++)
            {
                NLabel label = new NLabel(colHeadings[i]);
                label.Font = new NFont(NFontDescriptor.DefaultSansFamilyName, 9, ENFontStyle.Bold);
                table.Add(label);
            }

            int rowCount = imageNames.Count;

            for (int i = 0; i < rowCount; i++)
            {
                string resourceName = imageNames[i];
                string description  = NImageDecodingExampleHelper.GetImageDescription(descriptions, resourceName);

                NLabel nameLabel = new NLabel(resourceName);
                nameLabel.MaxWidth = 200;

                NLabel descriptionLabel = new NLabel(description);
                descriptionLabel.MaxWidth     = 200;
                descriptionLabel.TextWrapMode = ENTextWrapMode.WordWrap;

                NImage    novImage    = NImageDecodingExampleHelper.LoadImage(resourceName, ENCodecPreference.OnlyNOV);
                NImageBox novImageBox = new NImageBox(novImage);
                novImageBox.ImageMapping = new NAlignTextureMapping(ENHorizontalAlignment.Center, ENVerticalAlignment.Center);

                NImage    nativeImage    = NImageDecodingExampleHelper.LoadImage(resourceName, ENCodecPreference.PreferNative);
                NImageBox nativeImageBox = new NImageBox(nativeImage);
                nativeImageBox.ImageMapping = new NAlignTextureMapping(ENHorizontalAlignment.Center, ENVerticalAlignment.Center);

                table.Add(nameLabel);
                table.Add(descriptionLabel);
                table.Add(novImageBox);
                table.Add(nativeImageBox);
            }

            // The table must be scrollable
            NScrollContent scroll = new NScrollContent();

            scroll.Content = table;
            return(scroll);
        }
예제 #19
0
        protected override NWidget CreateExampleContent()
        {
            // Create a table layout panel
            m_Table = new NTableFlowPanel();
            m_Table.HorizontalPlacement = ENHorizontalPlacement.Left;
            m_Table.VerticalPlacement   = ENVerticalPlacement.Top;
            m_Table.Padding             = new NMargins(30);
            m_Table.HorizontalSpacing   = 30;
            m_Table.VerticalSpacing     = 30;
            m_Table.MaxOrdinal          = 4;

            string[] names = new string[]
            {
                "Align",
                "Fit and Align",
                "Fixed",
                "Stretch",
                "Stretch X, Align Y",
                "Stretch Y, Align X",
                "Tile"
            };

            NTextureMapping[] mappings = new NTextureMapping[]
            {
                new NAlignTextureMapping(ENHorizontalAlignment.Left, ENVerticalAlignment.Top),
                new NFitAndAlignTextureMapping(ENHorizontalAlignment.Center, ENVerticalAlignment.Center),
                new NFixedTextureMapping(NMultiLength.NewPercentage(10), ENHorizontalAlignment.Left, NMultiLength.NewPercentage(10), ENVerticalAlignment.Top),
                new NStretchTextureMapping(),
                new NStretchXAlignYTextureMapping(ENVerticalAlignment.Bottom, ENTileMode.None),
                new NStretchYAlignXTextureMapping(ENHorizontalAlignment.Right, ENTileMode.None),
                new NTileTextureMapping()
            };

            // Add widgets with the proper filling and names to the panel
            for (int i = 0; i < mappings.Length; i++)
            {
                NStackPanel stack = new NStackPanel();
                m_Table.Add(stack);
                stack.Direction = ENHVDirection.TopToBottom;
                stack.FillMode  = ENStackFillMode.First;
                stack.FitMode   = ENStackFitMode.First;

                // Create a widget with the proper filling
                NCanvas canvas = new NCanvas();
                canvas.PreferredSize = new NSize(defaultCanvasWidth, defaultCanvasHeight);
                NImageFill fill = new NImageFill(NResources.Image_Artistic_Plane_png);
                fill.TextureMapping = mappings[i];
                canvas.Tag          = fill;
                stack.Add(canvas);
                canvas.PrePaint += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint);

                // Create a label with the corresponding name
                NLabel label = new NLabel(names[i]);
                stack.Add(label);
                label.HorizontalPlacement = ENHorizontalPlacement.Center;
            }

            // The table must be scrollable
            NScrollContent scroll = new NScrollContent();

            scroll.Content = m_Table;
            return(scroll);
        }
예제 #20
0
        protected override NWidget CreateExampleContent()
        {
            // Create a table panel to hold the canvases and the labels
            m_Table = new NTableFlowPanel();
            m_Table.HorizontalPlacement = ENHorizontalPlacement.Left;
            m_Table.VerticalPlacement   = ENVerticalPlacement.Top;
            m_Table.Padding             = new NMargins(30);
            m_Table.HorizontalSpacing   = 30;
            m_Table.VerticalSpacing     = 30;
            m_Table.MaxOrdinal          = 3;

            string[] texts = new string[]
            {
                "Azure",
                "Flow",
                "Bulb",
                "Eclipse",
                "The Eye",
                "Medusa",
                "Kaleidoscope",
                "Reactor",
                "Green"
            };

            // Create the advanced gradients
            NAdvancedGradientFill[] fills = new NAdvancedGradientFill[]
            {
                AzureLight,
                Flow,
                Bulb,
                Eclipse,
                TheEye,
                Medusa,
                Kaleidoscope,
                Reactor,
                Green
            };

            // Add a canvas for each demonstrated gradient
            for (int i = 0; i < fills.Length; i++)
            {
                NStackPanel stack = new NStackPanel();
                m_Table.Add(stack);
                stack.Direction = ENHVDirection.TopToBottom;
                stack.FillMode  = ENStackFillMode.First;
                stack.FitMode   = ENStackFitMode.First;

                // Create a widget with the proper filling
                NCanvas canvas = new NCanvas();
                canvas.PreferredSize = new NSize(defaultCanvasWidth, defaultCanvasHeight);
                canvas.Tag           = fills[i];
                stack.Add(canvas);
                canvas.PrePaint += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint);

                // Create a label with the corresponding name
                NLabel label = new NLabel(texts[i]);
                stack.Add(label);
                label.HorizontalPlacement = ENHorizontalPlacement.Center;
            }

            // The table must be scrollable
            NScrollContent scroll = new NScrollContent();

            scroll.Content = m_Table;
            return(scroll);
        }