Esempio n. 1
0
        void OnEditStrokeChanged(NEventArgs args)
        {
            NValueChangeEventArgs localValueChangeArgs = args as NValueChangeEventArgs;

            if (localValueChangeArgs != null)
            {
                for (int i = 0; i < m_arrStrokes.Length; i++)
                {
                    NStroke stroke = m_arrStrokes[i];
                    stroke.SetValue(localValueChangeArgs.Property, localValueChangeArgs.NewValue);

                    NCanvas canvas      = m_CanvasStack[i] as NCanvas;
                    double  strokeWidth = stroke.Width;

                    if (strokeWidth < 0)
                    {
                        strokeWidth = 0;
                    }

                    canvas.PreferredSize = GetCanvasPreferredSize(strokeWidth);

                    if (canvas != null)
                    {
                        canvas.InvalidateDisplay();
                    }
                }
            }
        }
        void InvalidateCanvases()
        {
            if (m_Table == null)
            {
                return;
            }

            INIterator <NNode> iterator = m_Table.GetSubtreeIterator(ENTreeTraversalOrder.DepthFirstPreOrder, new NInstanceOfSchemaFilter(NCanvas.NCanvasSchema));

            while (iterator.MoveNext())
            {
                NCanvas canvas = (NCanvas)iterator.Current;
                canvas.InvalidateDisplay();
            }
        }
        private void OnRadioGroupSelectedIndexChanged(NValueChangeEventArgs args)
        {
            if (m_Table == null)
            {
                return;
            }

            ENAdvancedGradientColorScheme[] predefinedGradientSchemes = NEnum.GetValues <ENAdvancedGradientColorScheme>();
            INIterator <NNode> iterator = m_Table.GetSubtreeIterator(ENTreeTraversalOrder.DepthFirstPreOrder, new NInstanceOfSchemaFilter(NCanvas.NCanvasSchema));

            int gradientVariant = (int)args.NewValue;
            int schemeIndex     = 0;

            while (iterator.MoveNext())
            {
                NCanvas canvas = (NCanvas)iterator.Current;
                canvas.Tag = NAdvancedGradientFill.Create(predefinedGradientSchemes[schemeIndex++], gradientVariant);
                canvas.InvalidateDisplay();
            }
        }
Esempio n. 4
0
        private void OnColorBoxSelectedColorChanged(NValueChangeEventArgs args)
        {
            if (m_Table == null)
            {
                return;
            }

            NColor    color    = (NColor)args.NewValue;
            NColorBox colorBox = (NColorBox)args.TargetNode;
            NProperty property = (NProperty)colorBox.Tag;

            INIterator <NNode> iterator = m_Table.GetSubtreeIterator(ENTreeTraversalOrder.DepthFirstPreOrder, new NInstanceOfSchemaFilter(NCanvas.NCanvasSchema));

            while (iterator.MoveNext())
            {
                NCanvas canvas = (NCanvas)iterator.Current;
                ((NHatchFill)canvas.Tag).SetValue(property, color);
                canvas.InvalidateDisplay();
            }
        }