protected static void InitializeConfigurationFields(int boardCellCount) { // initialize sizes imagePadding = 10; imagePixelWidth = 420; imagePixelHeight = 320; shadowOffset = 4; boardPadding = 10; // calculate additional sizes boardPixelWidth = (int)Math.Floor((double)((imagePixelWidth - imagePadding - 2 * boardPadding))); boardPixelHeight = (int)Math.Floor((double)((imagePixelHeight - imagePadding - 2 * boardPadding))); boardPixelWidth = Math.Min(boardPixelWidth, boardPixelHeight); boardPixelHeight = Math.Min(boardPixelWidth, boardPixelHeight); cellPixelWidth = (int)Math.Floor((double)(boardPixelWidth / boardCellCount)); cellPixelHeight = (int)Math.Floor((double)(boardPixelHeight / boardCellCount)); boardPixelWidth = cellPixelWidth * boardCellCount + 2 * boardPadding; boardPixelHeight = cellPixelHeight * boardCellCount + 2 * boardPadding; boardMarginLeft = (int)Math.Floor((double)(imagePixelWidth - boardPixelWidth) / 2); boardMarginTop = (int)Math.Floor((double)(imagePixelHeight - boardPixelHeight) / 2); // precache styles emptyCellFillStyle = new NColorFillStyle(Color.WhiteSmoke); completeCellFillStyle = new NColorFillStyle(Color.PeachPuff); hoverDeniedCellFillStyle = new NGradientFillStyle(GradientStyle.FromCenter, GradientVariant.Variant1, Color.Navy, Color.White); hoverAllowedCellFillStyle = new NGradientFillStyle(GradientStyle.FromCenter, GradientVariant.Variant1, Color.LimeGreen, Color.White); normalCellStrokeStyle = new NStrokeStyle(new NLength(1f, NGraphicsUnit.Pixel), Color.White); }
private NLinearScaleConfigurator ConfigureScale(NFillStyle rulerFillStyle, Color tickColor) { NLinearScaleConfigurator scale = new NLinearScaleConfigurator(); scale.RulerStyle.FillStyle = (NFillStyle)rulerFillStyle.Clone(); scale.RulerStyle.Shape = ScaleLevelShape.Bar; scale.RulerStyle.Height = new NLength(5, NGraphicsUnit.Point); scale.RulerStyle.BorderStyle.Color = tickColor; scale.OuterMajorTickStyle.LineStyle.Color = tickColor; scale.InnerMajorTickStyle.LineStyle.Color = tickColor; scale.MajorGridStyle.LineStyle.Color = tickColor; NScaleStripStyle strip = new NScaleStripStyle(); strip.StrokeStyle = null; strip.FillStyle = (NFillStyle)rulerFillStyle.Clone(); strip.FillStyle.SetTransparencyPercent(80); strip.SetShowAtWall(ChartWallType.Back, true); strip.SetShowAtWall(ChartWallType.Left, true); scale.StripStyles.Add(strip); scale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); scale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); return(scale); }
private void XAxisInterlacedStripeFillStyleButton_Click(object sender, System.EventArgs e) { NFillStyle fillStyle = null; if (NFillStyleTypeEditorNoAutomatic.Edit(m_XAxisInterlaceStyle.FillStyle, false, out fillStyle)) { m_XAxisInterlaceStyle.FillStyle = fillStyle; nChartControl1.Refresh(); } }
private void Bar3FillStyleButton_Click(object sender, System.EventArgs e) { NFillStyle fillStyleResult = null; if (NFillStyleTypeEditor.Edit((NFillStyle)m_Shape.FillStyles[2], out fillStyleResult)) { m_Shape.FillStyles[2] = fillStyleResult; nChartControl1.Refresh(); } }
private void Bar3FillStyle_Click(object sender, System.EventArgs e) { NFillStyle fillStyleResult; NFillStyle inFillStyle = (NFillStyle)m_Bar.FillStyles[3]; if (NFillStyleTypeEditor.Edit(inFillStyle, false, out fillStyleResult)) { m_Bar.FillStyles[3] = fillStyleResult; nChartControl1.Refresh(); } }
private void vertStripesButton_Click(object sender, System.EventArgs e) { NFillStyle style = view.Grid.VerticalStripesFillStyle; if (!NFillStyleTypeEditor.Edit(style, out style)) { return; } view.Grid.VerticalStripesFillStyle = style; view.SmartRefresh(); }
private void DimFillStyleButton_Click(object sender, System.EventArgs e) { NFillStyle fillStyle = null; if (NFillStyleTypeEditorNoAutomatic.Edit(m_NumericDisplay1.DimFillStyle, false, out fillStyle)) { m_NumericDisplay1.DimFillStyle = fillStyle; m_NumericDisplay2.DimFillStyle = fillStyle; m_NumericDisplay3.DimFillStyle = fillStyle; nChartControl1.Refresh(); } }
private void FillStyleButton_Click(object sender, EventArgs e) { NChart chart = nChartControl1.Charts[0]; NLinearScaleConfigurator scale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; NScaleBreak scaleBreak = (NScaleBreak)scale.ScaleBreaks[0]; NFillStyle result = null; if (NFillStyleTypeEditor.Edit(scaleBreak.Style.FillStyle, out result)) { scaleBreak.Style.FillStyle = result; nChartControl1.Refresh(); } }
/// <summary> /// Shows the fill style editor for the specified styleable node /// </summary> /// <param name="styleable"></param> protected void ShowFillStyleEditor(INStyleable styleable) { if (styleable == null) { return; } NFillStyle fillStyle = styleable.ComposeFillStyle(); NFillStyle newFillStyle = null; if (NFillStyleTypeEditor.Edit(fillStyle, out newFillStyle)) { NStyle.SetFillStyle(styleable, newFillStyle); document.RefreshAllViews(); } }
private void TickFillStyleButton_Click(object sender, EventArgs e) { if (m_Chart == null) { return; } NLinearScaleConfigurator scale = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; NFillStyle fillStyle = null; if (NFillStyleTypeEditorNoAutomatic.Edit(scale.OuterMajorTickStyle.FillStyle, false, out fillStyle)) { scale.OuterMajorTickStyle.FillStyle = fillStyle; nChartControl1.Refresh(); } }
protected NCompositeShape CreateLegendItem(NRectangleF bounds, string str, NFillStyle fillStyle) { NCompositeShape item = new NCompositeShape(); NRectanglePath rect = new NRectanglePath(0, 0, 2, 2); NStyle.SetFillStyle(rect, (fillStyle.Clone() as NFillStyle)); item.Primitives.AddChild(rect); NTextPrimitive text = new NTextPrimitive(str, new NRectangleF(2, 0, 4, 2)); item.Primitives.AddChild(text); item.UpdateModelBounds(); item.Bounds = bounds; return(item); }
protected static void InitializeConfigurationFields() { // initialize sizes imagePixelWidth = 420; imagePixelHeight = 320; imagePadding = 10; shadowOffset = 5; cellPixelWidth = 20; cellPixelHeight = 20; // calculate additional sizes boardCellCountWidth = (int)(Math.Floor((double)(imagePixelWidth - 2 * imagePadding) / cellPixelWidth)); boardCellCountHeight = (int)(Math.Floor((double)(imagePixelHeight - 2 * imagePadding) / cellPixelHeight)); boardPixelWidth = boardCellCountWidth * cellPixelWidth; boardPixelHeight = boardCellCountHeight * cellPixelHeight; boardMarginLeft = (int)Math.Floor((double)(imagePixelWidth - boardPixelWidth) / 2) - (int)Math.Floor((double)(shadowOffset / 2)); boardMarginTop = (int)Math.Floor((double)(imagePixelHeight - boardPixelHeight) / 2) - (int)Math.Floor((double)(shadowOffset / 2)); centerCellCountX = (int)Math.Floor((double)boardCellCountWidth / 2); centerCellCountY = (int)Math.Floor((double)boardCellCountHeight / 2); // an r-pentamino configuration initialConfigurationCoordinates = new int[][] { new int[] { centerCellCountX, centerCellCountY - 1 }, new int[] { centerCellCountX + 1, centerCellCountY - 1 }, new int[] { centerCellCountX - 1, centerCellCountY }, new int[] { centerCellCountX, centerCellCountY }, new int[] { centerCellCountX, centerCellCountY + 1 }, }; // precache styles emptyCellFillStyle = new NColorFillStyle(Color.White); fullCellFillStyle = new NColorFillStyle(Color.Red); emptyPinnedCellFillStyle = new NColorFillStyle(Color.LightGray); fullPinnedCellFillStyle = new NColorFillStyle(Color.Brown); normalCellStrokeStyle = new NStrokeStyle(new NLength(1f, NGraphicsUnit.Pixel), Color.Black); highliteCellStrokeStyle = new NStrokeStyle(new NLength(2f, NGraphicsUnit.Pixel), Color.Blue); }
/// <summary> /// Gets the transparency percent depending on the type of the fillStyle. /// </summary> /// <param name="fillStyle"></param> /// <returns>The transparency percent.</returns> private float GetTransparencyPercent(NFillStyle fillStyle) { if (fillStyle == null) { return(0); } if (fillStyle is NColorFillStyle) { byte alpha = ((NColorFillStyle)fillStyle).Color.A; return(PercentFromAlpha(alpha)); } if (fillStyle is NGradientFillStyle) { byte alphaBeginColor = ((NGradientFillStyle)fillStyle).BeginColor.A; byte alphaEndColor = ((NGradientFillStyle)fillStyle).EndColor.A; return(Math.Max(alphaBeginColor, alphaEndColor)); } if (fillStyle is NHatchFillStyle) { byte foregroundAlpha = ((NHatchFillStyle)fillStyle).ForegroundColor.A; byte backgroundAlpha = ((NHatchFillStyle)fillStyle).BackgroundColor.A; return(Math.Max(foregroundAlpha, backgroundAlpha)); } if (fillStyle is NImageFillStyle) { byte alpha = ((NImageFillStyle)fillStyle).Alpha; return(PercentFromAlpha(alpha)); } if (fillStyle is NAdvancedGradientFillStyle) { byte alpha = ((NAdvancedGradientFillStyle)fillStyle).BackgroundColor.A; return(PercentFromAlpha(alpha)); } return(0); }
public int Compare(object a, object b) { NFillStyle feA = (NFillStyle)a; NFillStyle feB = (NFillStyle)b; Color colorA = feA.GetPrimaryColor().ToColor(); Color colorB = feB.GetPrimaryColor().ToColor(); int aRGBSum = Convert.ToInt32(colorA.R) + Convert.ToInt32(colorA.G) + Convert.ToInt32(colorA.B); int bRGBSum = Convert.ToInt32(colorB.R) + Convert.ToInt32(colorB.G) + Convert.ToInt32(colorB.B); if (aRGBSum < bRGBSum) { return(-1); } if (aRGBSum > bRGBSum) { return(+1); } return(0); }
public NChemicalElement(int number, string symbol, string weight, int col, int row, NFillStyle fillStyle, string tooltip) { this.number = number; this.symbol = symbol; this.weight = weight; this.col = col; this.row = row; this.fillStyle = fillStyle; this.tooltip = tooltip; }
public MyCustomObject(double valueY, string label, NFillStyle fillStyle) { m_ValueY = valueY; m_Label = label; m_FillStile = fillStyle; }
/// <summary> /// /// </summary> /// <param name="flowChartingShape"></param> /// <param name="bounds"></param> /// <param name="text"></param> /// <param name="fillStyle"></param> /// <returns></returns> public NShape CreateFlowChartingShape(FlowChartingShapes flowChartingShape, NRectangleF bounds, string text, NFillStyle fillStyle) { NFlowChartingShapesFactory factory = new NFlowChartingShapesFactory(document); NShape shape = factory.CreateShape((int)flowChartingShape); shape.Bounds = bounds; shape.Text = text; shape.Style.FillStyle = (NFillStyle)fillStyle.Clone(); document.ActiveLayer.AddChild(shape); return(shape); }
/// <summary> /// /// </summary> /// <param name="basicShape"></param> /// <param name="bounds"></param> /// <param name="text"></param> /// <param name="fillStyle"></param> /// <param name="addToActiveLayer"></param> /// <returns></returns> public NShape CreateBasicShape(BasicShapes basicShape, NRectangleF bounds, string text, NFillStyle fillStyle, bool addToActiveLayer) { NBasicShapesFactory factory = new NBasicShapesFactory(document); NShape shape = factory.CreateShape((int)basicShape); shape.Bounds = bounds; shape.Text = text; shape.Style.FillStyle = (NFillStyle)fillStyle.Clone(); if (addToActiveLayer) { document.ActiveLayer.AddChild(shape); } return(shape); }
/// <summary> /// /// </summary> /// <param name="basicShape"></param> /// <param name="bounds"></param> /// <param name="text"></param> /// <param name="fillStyle"></param> /// <returns></returns> public NShape CreateBasicShape(BasicShapes basicShape, NRectangleF bounds, string text, NFillStyle fillStyle) { return(CreateBasicShape(basicShape, bounds, text, fillStyle, true)); }