protected void OnExportWithDirect2DMenuItemClick(NEventArgs args) { #if SUPPORT_DIRECT2D && DEBUG string fileName = "d:\\D2D_output.png"; NSize imgSize = new NSize(this.Width, this.Height); try { Nevron.Windows.DirectX.ND2DGraphicsHelper gh = new Nevron.Windows.DirectX.ND2DGraphicsHelper(); INGraphics2D pdfG = gh.CreateGraphics((int)imgSize.Width, (int)imgSize.Height); NRegion clip = NRegion.FromRectangle(new NRectangle(0, 0, imgSize.Width, imgSize.Height)); NMatrix canvasTransform = NMatrix.Identity; NMatrix invertedCT = canvasTransform; invertedCT.Invert(); NPaintVisitor visitor = new NPaintVisitor(pdfG, 96, invertedCT, clip); // assign media // forward traverse the display tree visitor.BeginPainting(); VisitDisplaySubtree(visitor); visitor.EndPainting(); gh.SaveToFileAndDispose(fileName); System.Diagnostics.Process.Start(fileName); } catch (Exception x) { NMessageBox.Show(null, x.Message, "Exception", ENMessageBoxButtons.OK); } #endif }
private void RecreateSymbols() { NColor color = m_ColorBox.SelectedColor; double length = InitialSize * Math.Pow(2, m_RadioGroup.SelectedIndex); NSize size = new NSize(length, length); m_SymbolsTable.Clear(); ENSymbolShape[] symbolShapes = NEnum.GetValues <ENSymbolShape>(); int count = symbolShapes.Length / 2 + symbolShapes.Length % 2; for (int i = 0; i < count; i++) { // Add a symbol box to the first column int column1Index = i; AddSymbolBox(symbolShapes[column1Index], size, color); // Add a symbol box to the second column int column2Index = count + i; if (column2Index < symbolShapes.Length) { NSymbolBox symbolBox = AddSymbolBox(symbolShapes[column2Index], size, color); symbolBox.Margins = new NMargins(NDesign.HorizontalSpacing * 10, 0, 0, 0); } } }
public void Paint(NPaintVisitor visitor) { NColor color; switch (State) { case ENTouchDeviceState.Down: color = NColor.Blue; break; case ENTouchDeviceState.Unknown: color = NColor.Green; break; case ENTouchDeviceState.Up: color = NColor.Red; break; default: throw new Exception("New ENTouchDeviceState?"); } NSize size = Size; if (size.Width == 0 || size.Height == 0) { size = new NSize(5, 5); } visitor.SetStroke(new NStroke(color)); visitor.PaintEllipse(NRectangle.FromCenterAndSize(Location, size)); }
/// <summary> /// Performs the element post-children custom paint. Overriden to paint the status /// of this example tile (if it has one) in its bottom-left corner. /// </summary> /// <param name="visitor"></param> protected override void OnPostPaint(NPaintVisitor visitor) { base.OnPostPaint(visitor); if (String.IsNullOrEmpty(m_Status)) { return; } // Paint a new label in the bottom left corner NRectangle bounds = GetContentEdge(); NFont font = new NFont(FontName, 5.0, ENFontStyle.Regular); font.RasterizationMode = ENFontRasterizationMode.Aliased; NSize textSize = font.MeasureString(m_Status, this.OwnerDocument); NRectangle textRect = new NRectangle(bounds.X - 1, bounds.Bottom - textSize.Height, textSize.Width + 3, textSize.Height); // Paint the text background NColor color = HomePage.GetStatusColor(m_Status); visitor.SetFill(color); visitor.PaintRectangle(textRect); // Paint the text visitor.SetFill(NColor.White); visitor.SetFont(font); NPoint location = textRect.Location; NPaintTextPointSettings settings = new NPaintTextPointSettings(); visitor.PaintString(location, m_Status, ref settings); }
public ToolbarButton(string title, string commandName, string iconFile, NSize iconSize, bool isClientSide) { this.Title = title; this.CommandName = commandName; this.IconFile = iconFile; this.IconSize = iconSize; this.IsColorSelector = false; this.IsClientSide = isClientSide; }
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 UpdateRulerStyleForAxis(NCartesianAxis axis) { NStandardScale scale = (NStandardScale)axis.Scale; NSize capSize = new NSize(m_SizeUpDown.Value, m_SizeUpDown.Value); // apply style to begin and end caps scale.Ruler.BeginCap = new NRulerCapStyle((ENCapShape)m_BeginCapShapeComboBox.SelectedIndex, capSize, 0, new NColorFill(NColor.Black), new NStroke(NColor.Black)); scale.Ruler.EndCap = new NRulerCapStyle((ENCapShape)m_EndCapShapeComboBox.SelectedIndex, capSize, 3, new NColorFill(NColor.Black), new NStroke(NColor.Black)); scale.Ruler.ScaleBreakCap = new NRulerCapStyle((ENCapShape)m_ScaleBreakCapShapeComboBox.SelectedIndex, capSize, 0, new NColorFill(NColor.Black), new NStroke(NColor.Black)); scale.Ruler.PaintOnScaleBreaks = m_PaintOnScaleBreaksCheckBox.Checked; }
private void Initialize() { m_fHorizontalSpacing = 30; m_fVerticalSpacing = 30; m_VerticesSize = new NSize(40, 40); m_VerticesShape = ENBasicShape.Rectangle; m_VerticesUserClass = ""; m_EdgesUserClass = ""; m_ShapeFactory = new NBasicShapeFactory(); }
/// <summary> /// Gets the padding of the element. /// </summary> /// <returns></returns> public override NMargins GetPadding() { NMargins padding = base.GetPadding(); string status = Status; if (String.IsNullOrEmpty(status) == false) { NSize statusTextSize = StatusFont.MeasureString(Status, OwnerDocument); padding.Right += statusTextSize.Width + StatusLeftPadding + StatusRightPadding; } return(padding); }
private NSymbolBox AddSymbolBox(ENSymbolShape symbolShape, NSize size, NColor color) { NSymbol symbol = NSymbol.Create(symbolShape, size, color); NSymbolBox symbolBox = new NSymbolBox(symbol); m_SymbolsTable.Add(symbolBox); NLabel label = new NLabel(NStringHelpers.InsertSpacesBeforeUppersAndDigits(symbolShape.ToString())); label.VerticalPlacement = ENVerticalPlacement.Center; m_SymbolsTable.Add(label); return(symbolBox); }
private NGroupBox CreateGroupBox(object header, object content) { NGroupBox groupBox = new NGroupBox(header, content); // Check whether the application is in touch mode and set the Size of the group box. bool touchMode = NApplication.Desktop.TouchMode; NSize size = new NSize(150, 150); if (touchMode) { size = new NSize(250, 250); } groupBox.PreferredSize = size; return(groupBox); }
/// <summary> /// /// </summary> /// <param name="args"></param> private void OnCanvasPrePaint(NCanvasPaintEventArgs args) { NCanvas canvas = args.TargetNode as NCanvas; if (canvas == null) { return; } NPaintVisitor paintVisitor = args.PaintVisitor; NRectangle contentEge = canvas.GetContentEdge(); // create the settings NPaintTextRectSettings settings = new NPaintTextRectSettings(); settings.SingleLine = false; settings.WrapMode = ENTextWrapMode.WordWrap; settings.HorzAlign = ENTextHorzAlign.Left; settings.VertAlign = ENTextVertAlign.Top; // create the text string text = m_TextBox.Text; // calculate the text bounds the text bounds double resolution = canvas.OwnerDocument.GetEffectiveResolution(); NFont font = new NFont(NFontDescriptor.DefaultSansFamilyName, 10, ENFontStyle.Regular); NSize textSize = font.MeasureString(text.ToCharArray(), resolution, contentEge.Width, false, ref settings); NPoint center = contentEge.Center; NRectangle textBounds = new NRectangle( center.X - textSize.Width / 2.0, center.Y - textSize.Height / 2.0, textSize.Width, textSize.Height); // paint the bounding box paintVisitor.ClearStyles(); paintVisitor.SetFill(NColor.LightBlue); paintVisitor.PaintRectangle(textBounds); // init font and fill paintVisitor.SetFill(NColor.Black); paintVisitor.SetFont(font); // paint the text paintVisitor.PaintString(textBounds, text.ToCharArray(), ref settings); }
/// <summary> /// Creates a sample bar chart given title, values and labels /// </summary> /// <param name="size"></param> /// <param name="title"></param> /// <param name="values"></param> /// <param name="labels"></param> /// <returns></returns> private NParagraph CreateSampleBarChart(NSize size, string title, double[] values, string[] labels) { NChartView chartView = CreateCartesianChartView(); chartView.PreferredSize = size; // configure title chartView.Surface.Titles[0].Text = title; chartView.Surface.Titles[0].Margins = NMargins.Zero; chartView.Surface.Legends[0].Visibility = ENVisibility.Hidden; chartView.BorderThickness = NMargins.Zero; // configure chart NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0]; chart.Padding = new NMargins(20); // configure axes chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear); chart.Margins = NMargins.Zero; NBarSeries bar = new NBarSeries(); bar.LegendView.Mode = ENSeriesLegendMode.None; bar.DataLabelStyle = new NDataLabelStyle(false); chart.Series.Add(bar); for (int i = 0; i < values.Length; i++) { bar.DataPoints.Add(new NBarDataPoint(values[i])); } NOrdinalScale scaleX = (NOrdinalScale)chart.Axes[ENCartesianAxis.PrimaryX].Scale; scaleX.Labels.TextProvider = new NOrdinalScaleLabelTextProvider(labels); NParagraph paragraph = new NParagraph(); NWidgetInline chartInline = new NWidgetInline(); chartInline.Content = chartView; paragraph.Inlines.Add(chartInline); return(paragraph); }
void IHttpHandler.ProcessRequest(HttpContext context) { int populationDataId; int dataPointId; if (context.Request["id"] == null) { return; } string[] tokens = context.Request["id"].Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); if (tokens.Length != 2) { return; } if (!int.TryParse(tokens[0], out populationDataId)) { return; } if (!int.TryParse(tokens[1], out dataPointId)) { return; } NCustomToolsData.NData data = NCustomToolsData.Read(); MemoryStream ms = new MemoryStream(); NSize chartSize = new NSize(500, 200); NDocument document = CreateDocument(chartSize, data, populationDataId, dataPointId); NPngImageFormat imageFormat = new NPngImageFormat(); using (INImage image = CreateImage(document, chartSize, imageFormat)) { document.Refresh(); image.SaveToStream(ms, imageFormat); } byte[] bytes = ms.GetBuffer(); context.Response.ContentType = "image/png"; context.Response.OutputStream.Write(bytes, 0, bytes.Length); context.Response.Cache.SetCacheability(HttpCacheability.ServerAndPrivate); }
void OnCellSizeComboBoxSelectedIndexChanged(NValueChangeEventArgs arg) { double segmentWidth = 0.0; double segmentGap = 0.0; NSize cellSize = new NSize(0.0, 0.0); switch (m_CellSizeComboBox.SelectedIndex) { case 0: // small segmentWidth = 2.0; segmentGap = 1.0; cellSize = new NSize(15, 30); break; case 1: // normal segmentWidth = 3; segmentGap = 1; cellSize = new NSize(20, 40); break; case 2: // large segmentWidth = 4; segmentGap = 2; cellSize = new NSize(26, 52); break; } NNumericLedDisplay[] displays = new NNumericLedDisplay[] { m_NumericDisplay1, m_NumericDisplay2, m_NumericDisplay3 }; for (int i = 0; i < displays.Length; i++) { NNumericLedDisplay display = displays[i]; display.CellSize = cellSize; display.SegmentGap = segmentGap; display.SegmentWidth = segmentWidth; display.DecimalCellSize = cellSize; display.DecimalSegmentGap = segmentGap; display.DecimalSegmentWidth = segmentWidth; } }
/// <summary> /// Gets the min Width and Height of all book images /// </summary> /// <returns></returns> NSize GetMinBookImageSize() { NSize size = new NSize(double.MaxValue, double.MaxValue); for (int i = 0; i < m_Books.Count; i++) { NBook book = m_Books[i]; if (book.Image.Width < size.Width) { size.Width = book.Image.Width; } if (book.Image.Height < size.Height) { size.Height = book.Image.Height; } } return(size); }
public override void Initialize() { base.Initialize(); Dock = DockStyle.Fill; DockPadding.All = 10; m_Panel = new NGalleryPanel(); m_Panel.Location = new Point(8, 8); m_Panel.ClientPadding = new NPadding(1); m_Panel.Parent = this; m_iSuspendUpdate++; layoutCombo.FillFromEnum(typeof(GalleryPanelLayout)); layoutCombo.SelectedItem = m_Panel.ItemLayout; selectionModeCombo.FillFromEnum(typeof(GalleryPanelSelectionMode)); selectionModeCombo.SelectedItem = m_Panel.SelectionMode; NSize sz = m_Panel.ItemSize; itemSizeWidthNumeric.Value = sz.Width; itemSizeHeightNumeric.Value = sz.Height; hScrollVisibilityCombo.FillFromEnum(typeof(ScrollVisibility)); hScrollVisibilityCombo.SelectedItem = m_Panel.HScrollVisibility; vScrollVisibilityCombo.FillFromEnum(typeof(ScrollVisibility)); vScrollVisibilityCombo.SelectedItem = m_Panel.VScrollVisibility; hideSelCheck.Checked = m_Panel.HideSelection; nCheckBox1.Checked = m_Panel.EnableElementTooltips; skinBodyCheck.Checked = m_Panel.UseBodySkinning; showFocusCheck.Checked = m_Panel.ShowFocusRect; m_iSuspendUpdate--; InitItems(); }
private void RecreateSymbols() { NColor color = m_ColorBox.SelectedColor; double length = InitialSize * Math.Pow(2, m_RadioGroup.SelectedIndex); NSize size = new NSize(length, length); m_SymbolsTable.Clear(); // Create a triangle up symbol NPolygonSymbolShape shape = new NPolygonSymbolShape(new NPoint[] { new NPoint(0, size.Height), new NPoint(size.Width * 0.5, 0), new NPoint(size.Width, size.Height) }, ENFillRule.EvenOdd); shape.Fill = new NColorFill(color); NSymbol symbol1 = new NSymbol(); symbol1.Add(shape); AddSymbolBox(symbol1, "Triangle Up"); // Create a rectangle with an ellipse NRectangleSymbolShape rectShape = new NRectangleSymbolShape(0, 0, size.Width, size.Height); rectShape.Fill = new NColorFill(color); NEllipseSymbolShape ellipseShape = new NEllipseSymbolShape(size.Width / 4, size.Height / 4, size.Width / 2, size.Height / 2); ellipseShape.Fill = new NColorFill(color.Invert()); NSymbol symbol2 = new NSymbol(); symbol2.Add(rectShape); symbol2.Add(ellipseShape); AddSymbolBox(symbol2, "Rectangle with an ellipse"); }
private void OnPrintPage(NPrintDocument sender, NPrintPageEventArgs e) { NSize pageSizeDIP = new NSize(this.Width, this.Height); try { NMargins pageMargins = NMargins.Zero; NRegion clip = NRegion.FromRectangle(new NRectangle(0, 0, e.PrintableArea.Width, e.PrintableArea.Height)); NMatrix transform = new NMatrix(e.PrintableArea.X, e.PrintableArea.Y); NPaintVisitor visitor = new NPaintVisitor(e.Graphics, 300, transform, clip); // forward traverse the display tree this.OwnerWindow.VisitDisplaySubtree(visitor); e.HasMorePages = false; } catch (Exception x) { NMessageBox.Show(x.Message, "Exception", ENMessageBoxButtons.OK, ENMessageBoxIcon.Error); } }
/// <summary> /// Performs the element post-children custom paint. Overriden to paint the status /// of this category header's group (if it has one) in the top-right corner of the header. /// </summary> /// <param name="visitor"></param> protected override void OnPostPaint(NPaintVisitor visitor) { base.OnPostPaint(visitor); if (String.IsNullOrEmpty(m_Status)) { return; } // Determine the text bounds NRectangle bounds = GetContentEdge(); NSize textSize = Font.MeasureString(((NLabel)Box2).Text); NRectangle textBounds = NRectangle.FromCenterAndSize(bounds.Center, textSize.Width, textSize.Height); textBounds.X += Box1.Width / 2; // Calculate a rectangle for the status text located to the right of the text rectangle textSize = StatusFont.MeasureString(m_Status, OwnerDocument); NRectangle textRect = new NRectangle(textBounds.Right + StatusLeftPadding, textBounds.Top, textSize.Width + StatusRightPadding, textSize.Height); // Paint the text background NExamplesHomePage homePage = (NExamplesHomePage)GetFirstAncestor(NExamplesHomePage.NExamplesHomePageSchema); NColor color = homePage.GetStatusColor(m_Status); visitor.SetFill(color); visitor.PaintRectangle(textRect); // Paint the text visitor.SetFill(NColor.White); visitor.SetFont(StatusFont); NPoint location = textRect.Location; NPaintTextPointSettings settings = new NPaintTextPointSettings(); visitor.PaintString(location, m_Status, ref settings); }
protected void OnPrintPage(NPrintDocument sender, NPrintPageEventArgs e) { NSize pageSizeDIP = new NSize(this.Width, this.Height); try { double clipW = e.PrintableArea.Width; double clipH = e.PrintableArea.Height; NRegion clip = NRegion.FromRectangle(new NRectangle(0, 0, clipW, clipH)); NMatrix transform = new NMatrix(e.PrintableArea.X, e.PrintableArea.Y); NPaintVisitor visitor = new NPaintVisitor(e.Graphics, 300, transform, clip); // forward traverse the display tree VisitDisplaySubtree(visitor); e.HasMorePages = false; } catch (Exception ex) { NMessageBox.Show(null, ex.Message, "Exception", ENMessageBoxButtons.OK, ENMessageBoxIcon.Error); } }
protected override void PopulateRichText() { { NSection headerSection = new NSection(); m_RichText.Content.Sections.Add(headerSection); headerSection.Blocks.Add(CreateTitleParagraph("Welcome to our annual report\nFurther information on Sample Group can be found at:\n www.samplegroup.com")); headerSection.Blocks.Add(CreateContentParagraph("Sample Group is a diversified international market infrastructure and capital markets business sitting at the heart of the world’s financial community.")); headerSection.Blocks.Add(CreateContentParagraph("The Group operates a broad range of international equity, bond and derivatives markets, including Stock Exchange; Europe’s leading fixed income market; and a pan-European equities MTF. Through its platforms, the Group offers international business and investors unrivalled access to Europe’s capital markets.")); headerSection.Blocks.Add(CreateContentParagraph("Post trade and risk management services are a significant part of the Group’s business operations. In addition to majority ownership of multi-asset global CCP operator, Sunset Group, the Group operates G&B, a clearing house; Monte Span, the European settlement business; and AutoSettle, the Group’s newly established central securities depository based in Luxembourg. The Group is a global leader in indexing and analytic solutions. The Group also provides customers with an extensive range of real time and reference data products. The Group is a leading developer of high performance trading platforms and capital markets software for customers around the world, through MillenniumIT. Since December 2014, the Group has owned Bonita Investments, an investment management business.")); headerSection.Blocks.Add(CreateContentParagraph("Headquartered in London, with significant operations in North America, China and Russia, the Group employs approximately 6000 people")); } { NSection financialHighlightsSection = new NSection(); financialHighlightsSection.BreakType = ENSectionBreakType.NextPage; m_RichText.Content.Sections.Add(financialHighlightsSection); financialHighlightsSection.Blocks.Add(CreateTitleParagraph("Financial highlights")); financialHighlightsSection.Blocks.Add(CreateContentParagraph("The following charts provide insight to the group's total income, operating profit, and earnings per share for the years since 2008.")); NSize chartSize = new NSize(300, 200); { NTable table = new NTable(); table.AllowSpacingBetweenCells = false; table.Columns.Add(new NTableColumn()); table.Columns.Add(new NTableColumn()); financialHighlightsSection.Blocks.Add(table); { NTableRow tableRow = new NTableRow(); table.Rows.Add(tableRow); { NTableCell tableCell = new NTableCell(); tableCell.Blocks.Add(CreateSampleBarChart(chartSize, "Adjusted total income", new double[] { 674.9, 814.8, 852.9, 1, 213.1, 1, 043.9, 1, 096.4, 1, 381.1 }, new string[] { "2008", "2009", "2010", "2011", "2012", "2013", "2014" })); tableRow.Cells.Add(tableCell); } { NTableCell tableCell = new NTableCell(); tableCell.Blocks.Add(CreateSampleBarChart(chartSize, "Adjusted operating profit", new double[] { 341.1, 441.9, 430.2, 514.7, 417.5, 479.9, 558.0 }, new string[] { "2008", "2009", "2010", "2011", "2012", "2013", "2014" })); tableRow.Cells.Add(tableCell); } } { NTableRow tableRow = new NTableRow(); table.Rows.Add(tableRow); { NTableCell tableCell = new NTableCell(); tableCell.Blocks.Add(CreateSampleBarChart(chartSize, "Operating profit", new double[] { 283.0, 358.5, 348.4, 353.1, 242.1, 329.4, 346.0 }, new string[] { "2008", "2009", "2010", "2011", "2012", "2013", "2014" })); tableRow.Cells.Add(tableCell); } { NTableCell tableCell = new NTableCell(); tableCell.Blocks.Add(CreateSampleBarChart(chartSize, "Adjusted earnings per share", new double[] { 67.9, 92.6, 97.0, 98.6, 75.6, 96.5, 103.3 }, new string[] { "2008", "2009", "2010", "2011", "2012", "2013", "2014" })); tableRow.Cells.Add(tableCell); } } } } { NSection operationalHighlights = new NSection(); operationalHighlights.ColumnCount = 2; operationalHighlights.BreakType = ENSectionBreakType.NextPage; operationalHighlights.Blocks.Add(CreateTitleParagraph("Operational highlights")); m_RichText.Content.Sections.Add(operationalHighlights); operationalHighlights.Blocks.Add(CreateContentParagraph("The Group is delivering on its strategy, leveraging its range of products and services and further diversifying its offering through new product development and strategic investments. A few examples of the progress being made are highlighted below: ")); operationalHighlights.Blocks.Add(CreateContentParagraph("Capital Markets")); { NBulletList bulletList = new NBulletList(ENBulletListTemplateType.Bullet); m_RichText.Content.BulletLists.Add(bulletList); { NParagraph par = CreateContentParagraph("Revenues for calendar year 2014 increased by 12 per cent to £333.2 million (2013: £296.8 million). Primary Markets saw a seven year high in new issue activity with 219 new companies admitted, including AA, the largest UK capital raising IPO of the year"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } { NParagraph par = CreateContentParagraph("UK cash equity average daily value traded increased 15 per cent and average daily number of trades in Italy increased 16 per cent"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } { NParagraph par = CreateContentParagraph("Average daily value traded on Turquoise, our European cash equities MTF, increased 42 per cent to €3.7 billion per day and share of European trading increased to over 9 per cent"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } { NParagraph par = CreateContentParagraph("In Fixed Income, MTS cash and BondVision value traded increased by 32 per cent, while MTS Repo value traded increased by 3 per cent"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } } operationalHighlights.Blocks.Add(CreateContentParagraph("Post Trade Services")); { NBulletList bulletList = new NBulletList(ENBulletListTemplateType.Bullet); m_RichText.Content.BulletLists.Add(bulletList); { NParagraph par = CreateContentParagraph("Revenues for calendar year 2014 increased by 3 per cent in constant currency terms. In sterling terms revenues declined by 2 per cent to £96.5 million"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } { NParagraph par = CreateContentParagraph("Our Group cleared 69.7 million equity trades, up 16 per cent and 39.0 million derivative contracts up 20 per cent"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } { NParagraph par = CreateContentParagraph("Our Group is the largest CSD entering the first wave of TARGET2-Securities from June 2015. Successful testing with the European Central Bank finished in December 2014. In addition, Our Group moved settlement of contracts executed on the Italian market from T+3 to T+2 in October 2014"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } } operationalHighlights.Blocks.Add(CreateContentParagraph("Post Trade Services 2")); { NBulletList bulletList = new NBulletList(ENBulletListTemplateType.Bullet); m_RichText.Content.BulletLists.Add(bulletList); { NParagraph par = CreateContentParagraph("Adjusted income for the calendar year 2014 was £389.4 million, up 24 per cent on a pro forma constant currency basis. LCH.Clearnet received EMIR reauthorisation for the UK and France businesses — SwapClear, the world’s leading interest rate swap clearing service, cleared $642 trillion notional, up 26 per cent"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } { NParagraph par = CreateContentParagraph("Compression services at SwapClear reduced level of notional outstanding, from $426 trillion to $362 trillion"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } { NParagraph par = CreateContentParagraph("Our Group was granted clearing house recognition in Canada and Australia"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } { NParagraph par = CreateContentParagraph("Clearing of commodities for the London Metal Exchange ceased in September 2014 as expected"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } { NParagraph par = CreateContentParagraph("RepoClear, one of Europe’s largest fixed income clearers, cleared €73.4 trillion in nominal value, up 1 per cent"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } operationalHighlights.Blocks.Add(CreateContentParagraph("Group Adjusted Total Income by segment")); NTable table = new NTable(); table.Margins = new NMargins(10); table.AllowSpacingBetweenCells = false; operationalHighlights.Blocks.Add(table); table.Columns.Add(new NTableColumn()); table.Columns.Add(new NTableColumn()); table.Columns.Add(new NTableColumn()); { NTableRow tableRow = new NTableRow(); table.Rows.Add(tableRow); NTableCell tc1 = CreateTableCellWithBorder(); tableRow.Cells.Add(tc1); NTableCell tc2 = CreateTableCellWithBorder(); tc2.Blocks.Add(CreateContentParagraph("2013")); tableRow.Cells.Add(tc2); NTableCell tc3 = CreateTableCellWithBorder(); tc3.Blocks.Add(CreateContentParagraph("2014")); tableRow.Cells.Add(tc3); } { NTableRow tableRow = new NTableRow(); table.Rows.Add(tableRow); NTableCell tc1 = CreateTableCellWithBorder(); tc1.Blocks.Add(CreateContentParagraph("Capital Markets")); tableRow.Cells.Add(tc1); NTableCell tc2 = CreateTableCellWithBorder(); tc2.Blocks.Add(CreateContentParagraph("249.1")); tableRow.Cells.Add(tc2); NTableCell tc3 = CreateTableCellWithBorder(); tc3.Blocks.Add(CreateContentParagraph("333.2")); tableRow.Cells.Add(tc3); } { NTableRow tableRow = new NTableRow(); table.Rows.Add(tableRow); NTableCell tc1 = CreateTableCellWithBorder(); tc1.Blocks.Add(CreateContentParagraph("Post Trade Service")); tableRow.Cells.Add(tc1); NTableCell tc2 = CreateTableCellWithBorder(); tc2.Blocks.Add(CreateContentParagraph("94.7")); tableRow.Cells.Add(tc2); NTableCell tc3 = CreateTableCellWithBorder(); tc3.Blocks.Add(CreateContentParagraph("129.1")); tableRow.Cells.Add(tc3); } { NTableRow tableRow = new NTableRow(); table.Rows.Add(tableRow); NTableCell tc1 = CreateTableCellWithBorder(); tc1.Blocks.Add(CreateContentParagraph("Information Services ")); tableRow.Cells.Add(tc1); NTableCell tc2 = CreateTableCellWithBorder(); tc2.Blocks.Add(CreateContentParagraph("281.0")); tableRow.Cells.Add(tc2); NTableCell tc3 = CreateTableCellWithBorder(); tc3.Blocks.Add(CreateContentParagraph("373.0")); tableRow.Cells.Add(tc3); } { NTableRow tableRow = new NTableRow(); table.Rows.Add(tableRow); NTableCell tc1 = CreateTableCellWithBorder(); tc1.Blocks.Add(CreateContentParagraph("Technology Services")); tableRow.Cells.Add(tc1); NTableCell tc2 = CreateTableCellWithBorder(); tc2.Blocks.Add(CreateContentParagraph("47.3")); tableRow.Cells.Add(tc2); NTableCell tc3 = CreateTableCellWithBorder(); tc3.Blocks.Add(CreateContentParagraph("66.0")); tableRow.Cells.Add(tc3); } { NTableRow tableRow = new NTableRow(); table.Rows.Add(tableRow); NTableCell tc1 = CreateTableCellWithBorder(); tc1.Blocks.Add(CreateContentParagraph("Other")); tableRow.Cells.Add(tc1); NTableCell tc2 = CreateTableCellWithBorder(); tc2.Blocks.Add(CreateContentParagraph("87.2")); tableRow.Cells.Add(tc2); NTableCell tc3 = CreateTableCellWithBorder(); tc3.Blocks.Add(CreateContentParagraph("90.4")); tableRow.Cells.Add(tc3); } } } }
NDocument CreateDocument(NSize chartSize, NCustomToolsData.NData data, int populationDataId, int dataPointId) { NDocument document = new NDocument(); document.RootPanel.Charts.Clear(); // set a chart title string sex; string total; if (populationDataId == data.TotalFemaleData.Id) { sex = "Female"; total = string.Format("{0:0,#} +/-{1:0,#}", data.TotalFemaleData.Rows[dataPointId].Value, data.TotalFemaleData.Rows[dataPointId].Error); } else { sex = "Male"; total = string.Format("{0:0,#} +/-{1:0,#}", data.TotalMaleData.Rows[dataPointId].Value, data.TotalMaleData.Rows[dataPointId].Error); } NLabel header = document.RootPanel.Labels.AddHeader(string.Format("{0}, {1}, Population Data per Race<br/><font size='9pt'>Total of All Races: {2}</font>", sex, data.AgeRanges[dataPointId].Title, total)); header.TextStyle.TextFormat = TextFormat.XML; header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 13, FontStyle.Italic); header.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Left; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL( new NLength(3, NRelativeUnit.ParentPercentage), new NLength(3, NRelativeUnit.ParentPercentage)); // add the chart NCartesianChart chart = new NCartesianChart(); document.RootPanel.Charts.Add(chart); chart.SetPredefinedChartStyle(PredefinedChartStyle.HorizontalLeft); chart.Margins = new NMarginsL(9, 40, 9, 9); chart.Location = new NPointL( new NLength(0, NRelativeUnit.ParentPercentage), new NLength(0, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL( new NLength(100, NRelativeUnit.ParentPercentage), new NLength(100, NRelativeUnit.ParentPercentage)); chart.Width = chartSize.Width + 180; chart.Height = chartSize.Height; NLinearScaleConfigurator scaleY = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; scaleY.LabelValueFormatter = new NNumericValueFormatter("0,,.#M"); NOrdinalScaleConfigurator scaleX = new NOrdinalScaleConfigurator(); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; scaleX.AutoLabels = false; scaleX.MajorTickMode = MajorTickMode.CustomTicks; scaleX.CustomLabelFitModes = new LabelFitMode[] { LabelFitMode.AutoScale }; scaleX.CustomLabelsLevelOffset = new NLength(4); NBarSeries barSeries = chart.Series.Add(SeriesType.Bar) as NBarSeries; barSeries.DataLabelStyle.Visible = false; int length = data.Races.Count; for (int i = 0; i < length; i++) { NCustomToolsData.NRace race = data.Races[i]; double value; if (populationDataId == race.MaleData.Id) { value = race.MaleData.Rows[dataPointId].Value; } else { value = race.FemaleData.Rows[dataPointId].Value; } barSeries.Values.Add(value); NCustomValueLabel vl = new NCustomValueLabel(i, race.Title); vl.Style.ContentAlignment = ContentAlignment.MiddleRight; scaleX.CustomLabels.Add(vl); } return(document); }
/// <summary> /// /// </summary> /// <param name="row"></param> /// <param name="col"></param> /// <param name="origin"></param> /// <param name="size"></param> /// <param name="spacing"></param> /// <returns></returns> protected NRectangle GetGridCell(int row, int col, NPoint origin, NSize size, NSize spacing) { return(new NRectangle(origin.X + col * (size.Width + spacing.Width), origin.Y + row * (size.Height + spacing.Height), size.Width, size.Height)); }
/// <summary> /// /// </summary> /// <returns></returns> protected override NWidget CreateExampleContent() { NChartView chartView = CreateCartesianChartView(); // configure title chartView.Surface.Titles[0].Text = "Cluster Stack Bar Labels"; // configure chart m_Chart = (NCartesianChart)chartView.Surface.Charts[0]; m_Chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear); // configure Y axis NLinearScale scaleY = new NLinearScale(); scaleY.MajorGridLines.Stroke.DashStyle = ENDashStyle.Dash; m_Chart.Axes[ENCartesianAxis.PrimaryY].Scale = scaleY; // add interlaced stripe for Y axis NScaleStrip stripStyle = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; scaleY.Strips.Add(stripStyle); NSize dataPointSafeguardSize = new NSize(2, 2); // series 1 m_Bar1 = new NBarSeries(); m_Chart.Series.Add(m_Bar1); m_Bar1.Name = "Bar 1"; m_Bar1.Fill = new NColorFill(NColor.DarkOrange); m_Bar1.DataLabelStyle = CreateDataLabelStyle(ENVerticalAlignment.Center); // series 2 m_Bar2 = new NBarSeries(); m_Chart.Series.Add(m_Bar2); m_Bar2.Name = "Bar 2"; m_Bar2.MultiBarMode = ENMultiBarMode.Stacked; m_Bar2.Fill = new NColorFill(NColor.OrangeRed); m_Bar2.DataLabelStyle = CreateDataLabelStyle(ENVerticalAlignment.Center); // series 3 m_Bar3 = new NBarSeries(); m_Chart.Series.Add(m_Bar3); m_Bar3.Name = "Bar 3"; m_Bar3.MultiBarMode = ENMultiBarMode.Clustered; m_Bar3.Fill = new NColorFill(NColor.LightGreen); m_Bar3.DataLabelStyle = CreateDataLabelStyle(ENVerticalAlignment.Top); // enable initial labels positioning m_Chart.LabelLayout.EnableInitialPositioning = true; // enable label adjustment m_Chart.LabelLayout.EnableLabelAdjustment = true; // series 1 data points must not be overlapped m_Bar1.LabelLayout.EnableDataPointSafeguard = true; m_Bar1.LabelLayout.DataPointSafeguardSize = dataPointSafeguardSize; // do not use label location proposals for series 1 m_Bar1.LabelLayout.UseLabelLocations = false; // series 2 data points must not be overlapped m_Bar2.LabelLayout.EnableDataPointSafeguard = true; m_Bar2.LabelLayout.DataPointSafeguardSize = dataPointSafeguardSize; // do not use label location proposals for series 2 m_Bar2.LabelLayout.UseLabelLocations = false; // series 3 data points must not be overlapped m_Bar3.LabelLayout.EnableDataPointSafeguard = true; m_Bar3.LabelLayout.DataPointSafeguardSize = dataPointSafeguardSize; // series 3 data labels can be placed above and below the origin point m_Bar3.LabelLayout.UseLabelLocations = true; m_Bar3.LabelLayout.LabelLocations = new NDomArray <ENLabelLocation>(new ENLabelLocation[] { ENLabelLocation.Top, ENLabelLocation.Bottom }); m_Bar3.LabelLayout.InvertLocationsIfIgnored = false; m_Bar3.LabelLayout.OutOfBoundsLocationMode = ENOutOfBoundsLocationMode.PushWithinBounds; // fill with random data OnGenerateDataButtonClick(null); return(chartView); }
public NTouchPoint(NPoint point, NSize size, ENTouchDeviceState state) { State = state; Location = point; Size = size; }
private NShape CreateAndShape() { NShape shape = new NShape(); shape.Init2DShape(); NSize normalSize = new NSize(1, 1); NGraphicsPath path = new NGraphicsPath(); // create input lines double x1 = 0; double y1 = normalSize.Height / 3; path.StartFigure(x1, y1); path.LineTo(normalSize.Width / 4, y1); double y2 = normalSize.Height * 2 / 3; double x2 = 0; path.StartFigure(x2, y2); path.LineTo(normalSize.Width / 4, y2); // create body path.StartFigure(normalSize.Width / 4, 0); path.LineTo(normalSize.Width / 4, 1); NPoint ellipseCenter = new NPoint(normalSize.Width / 4, 0.5); path.AddEllipseSegment(NRectangle.FromCenterAndSize(ellipseCenter, normalSize.Width, normalSize.Height), NMath.PIHalf, -NMath.PI); path.CloseFigure(); // create output double y3 = normalSize.Height / 2; double x3 = normalSize.Width; path.StartFigure(normalSize.Width * 3 / 4, y3); path.LineTo(x3, y3); shape.Geometry.AddRelative(new NDrawPath(new NRectangle(0, 0, 1, 1), path)); // create ports NPort input1 = new NPort(); input1.X = x1; input1.Y = y1; input1.Relative = true; input1.SetDirection(ENBoxDirection.Left); input1.FlowMode = ENPortFlowMode.Input; shape.Ports.Add(input1); NPort input2 = new NPort(); input2.X = x2; input2.Y = y2; input2.Relative = true; input2.SetDirection(ENBoxDirection.Left); input2.FlowMode = ENPortFlowMode.Input; shape.Ports.Add(input2); NPort output1 = new NPort(); output1.X = x3; output1.Y = y3; output1.Relative = true; output1.SetDirection(ENBoxDirection.Right); output1.FlowMode = ENPortFlowMode.Output; shape.Ports.Add(output1); // by default this shape does not accept shape-to-shape connections shape.DefaultShapeGlue = ENDefaultShapeGlue.None; // set text shape.Text = "AND"; return(shape); }
public override void Initialize() { base.Initialize(); NImageAndTextItem item; string text; Type t = GetType(); string path = "Nevron.Examples.UI.WinForm.Resources.Images.TaskDialog"; m_TaskDialog = new NTaskDialog(); m_TaskDialog.PreferredWidth = 350; m_TaskDialog.PredefinedButtons = TaskDialogButtons.Yes | TaskDialogButtons.No | TaskDialogButtons.Cancel; m_TaskDialog.Title = "Nevron User Interface for .NET"; //customize header item = m_TaskDialog.Content; item.Style.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; item.TreatAsOneEntity = false; item.ImageAlign = ContentAlignment.BottomRight; item.TextAlign = ContentAlignment.TopLeft; item.ImageTextRelation = ImageTextRelation.None; item.ImageAlpha = 0.5f; item.Image = NResourceHelper.BitmapFromResource(t, "computer_48_hot.png", path); item.ImageSize = new NSize(48, 48); item.Style.TextFillStyle = new NAdvancedGradientFillStyle(AdvancedGradientScheme.Red, 8); item.Style.TextShadowStyle = new NShadowStyle(ShadowType.LinearBlur, Color.Gray, 1, 1, 1F, 1); text = "<b><font size='10' face='Verdana' color='navy'>Nevron User Interface for .NET Q4 2006 is available!</font></b>"; text += "<br/><br/>Following are the new features:"; text += "<br/><br/><u>Chart for .NET:</u><br/><br/>"; text += "<ul liststyletype='decimal'>"; text += "<li>Brand new axis model.</li>"; text += "<li>Greatly improved date-time support.</li>"; text += "<li>Date-time scrolling.</li>"; text += "</ul>"; text += "<br/><u>User Interface for .NET:</u><br/><br/>"; text += "<ul liststyletype='decimal'>"; text += "<li>Extended DateTimePicker.</li>"; text += "<li>Vista-like TaskDialog.</li>"; text += "<li>Hyper-links per element basis.</li>"; text += "</ul>"; text += "<br/><font size='10' color='black'>Download the new version now?</font>"; item.Text = text; item = m_TaskDialog.Footer; item.HyperLinkClick += new NHyperLinkEventHandler(OnFooterHyperLinkClick); Icon icon = SystemIcons.Information; NSize imageSize = new NSize(icon.Width, icon.Height); item.Image = NSystemImages.Information; item.ImageSize = imageSize; text = "For more information visit <a href='http://www.nevron.com/News.aspx?content=News'>www.nevron.com</a>"; item.Text = text; item = m_TaskDialog.Verification; item.Text = "In future download new versions automatically"; propertyGrid.SelectedObject = m_TaskDialog; }
protected INImage CreateImage(NDrawingDocument document, NCanvas canvas, NSize size, NPngImageFormat imageFormat) { INImageFormatProvider imageFormatProvider = new NDiagramRasterImageFormatProvider(document, canvas); return(imageFormatProvider.ProvideImage(size, NResolution.ScreenResolution, imageFormat)); }
/// <summary> /// Creates the book store interface /// </summary> /// <param name="activePage"></param> void CreateBookStore(NPage activePage) { const double x1 = 50; const double x2 = x1 + 200; const double x3 = x2 + 50; const double x4 = x3 + 400; const double y1 = 50; const double y2 = y1 + 50; const double y3 = y2 + 50; const double y4 = y3 + 20; const double y5 = y4 + 200; const double y6 = y5 + 20; const double y7 = y6 + 50; // prev button NShape prevButtonShape = CreateButtonShape("Show Prev Book"); SetLeftTop(prevButtonShape, new NPoint(x1, y1)); ((NButton)prevButtonShape.Widget).Click += delegate(NEventArgs args) { LoadBook(m_nSelectedBook - 1); }; activePage.Items.Add(prevButtonShape); // next button NShape nextButtonShape = CreateButtonShape("Show Next Book"); SetRightTop(nextButtonShape, new NPoint(x2, y1)); ((NButton)nextButtonShape.Widget).Click += delegate(NEventArgs args) { LoadBook(m_nSelectedBook + 1); }; activePage.Items.Add(nextButtonShape); // add to cart NShape addToCartButton = CreateButtonShape("Add to Cart"); SetRightTop(addToCartButton, new NPoint(x2, y6)); ((NButton)addToCartButton.Widget).Click += delegate(NEventArgs args) { m_ShoppingCart.AddItem(m_Books[m_nSelectedBook], this); }; activePage.Items.Add(addToCartButton); // create selected book shapes NBasicShapeFactory basicShapes = new NBasicShapeFactory(); // selected image m_SelectedBookImage = basicShapes.CreateShape(ENBasicShape.Rectangle); SetLeftTop(m_SelectedBookImage, new NPoint(x1, y2)); NSize minBookSize = GetMinBookImageSize(); m_SelectedBookImage.Width = x2 - x1; m_SelectedBookImage.Height = y5 - y2; activePage.Items.Add(m_SelectedBookImage); // selected title m_SelectedBookTitle = basicShapes.CreateShape(ENBasicShape.Text); m_SelectedBookTitle.TextBlock.InitXForm(ENTextBlockXForm.ShapeBox); m_SelectedBookTitle.TextBlock.FontSize = 25; m_SelectedBookTitle.TextBlock.Fill = new NColorFill(NColor.DarkBlue); SetLeftTop(m_SelectedBookTitle, new NPoint(x3, y2)); m_SelectedBookTitle.Width = x4 - x3; m_SelectedBookTitle.Height = y3 - y2; activePage.Items.Add(m_SelectedBookTitle); // selected description m_SelectedBookDescription = basicShapes.CreateShape(ENBasicShape.Text); m_SelectedBookDescription.TextBlock.InitXForm(ENTextBlockXForm.ShapeBox); SetLeftTop(m_SelectedBookDescription, new NPoint(x3, y4)); m_SelectedBookDescription.Width = x4 - x3; m_SelectedBookDescription.Height = y5 - y4; activePage.Items.Add(m_SelectedBookDescription); // load the first book LoadBook(0); // create the shape that hosts the shopping cart widget NShape shoppingCartShape = new NShape(); shoppingCartShape.Init2DShape(); m_ShoppingCartWidget = new NContentHolder(); m_ShoppingCartWidget.Content = m_ShoppingCart.CreateWidget(this); shoppingCartShape.Widget = m_ShoppingCartWidget; SetLeftTop(shoppingCartShape, new NPoint(x1, y7)); BindSizeToDesiredSize(shoppingCartShape); activePage.Items.Add(shoppingCartShape); }