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); }
private void OnColorBoxSelectedColorChanged(NValueChangeEventArgs args) { m_ColorFills[0] = new NColorFill((NColor)args.NewValue); m_Canvas.InvalidateDisplay(); }