1. Tag Results
reading (3)
1 - 3 of 3
How to read image byte while rendering a WPF Chart (SfChart)?
This article explains how to read a WPF Chart (SfChart) as a stream of bytes and save it in an image format during rendering. A FileStream supports both read and write operations. In this example, a chart is captured as a stream of bytes and saved as a PNG image. The RenderTargetBitmap class specifies the target chart's width, height, and pixel format. The PngBitmapEncoder is used to encode the image to PNG format. When the button is clicked, the rendered chart image is generated in the bin\Debug folder. C# private void ImageExport_Click(object sender, RoutedEventArgs e) {            const string path = "Chart.png";   RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)ScatterChart.ActualWidth, (int)ScatterChart.ActualHeight,70d, 70d, PixelFormats.Pbgra32);   renderBitmap.Render(ScatterChart);   using (FileStream ostream = new FileStream(path, FileMode.Create))   {     PngBitmapEncoder Bitmapencoder = new PngBitmapEncoder();     Bitmapencoder.Frames.Add(BitmapFrame.Create(renderBitmap));     // encoder.Save(outStream);     ScatterChart.Save(ostream, Bitmapencoder);   } }  Output ConclusionI hope you enjoyed learning about how to read image byte while rendering a WPF Chart(SfChart).You can refer to our WPF Chart’s feature tour page to know about its other groundbreaking feature representations. You can also explore our   WPF Chart documentation to understand how to present and manipulate data.For current customers, you can check out our WPF components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our WPF Chart and other WPF components.If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
How to access the cell values for all the selected rows in WinForms GridControl?
Accessing the cell values for selected rows To access the cell values of the selected records, get the GridRangeInfoList of the selected rows. By using the list, loop through the range to get the fields. C# private void btnGetCellValue_Click(object sender, EventArgs e) {     GridRangeInfoList list = this.gridControl1.Selections.GetSelectedRows(true, false);     foreach (GridRangeInfo range in list)     {         for (int i = range.Top; i <= range.Bottom; i++)             for (int j = 1; j <= this.gridControl1.Model.ColCount; j++)             {                 //Prints the text in the output screen.                 Trace.WriteLine(this.gridControl1[i, j].Text);             }     } } VB Private Sub btnGetCellValue_Click (ByVal sender As Object, ByVal e As EventArgs)     Dim list As GridRangeInfoList = Me.gridControl1.Selections.GetSelectedRows(True, False)     For Each range As GridRangeInfo In list        For i As Integer = range.Top To range.Bottom           For j As Integer = 1 To Me.gridControl1.Model.ColCount              'Prints the text in the output screen.              Trace.WriteLine(Me.gridControl1(i, j).Text)           Next j        Next i     Next range End Sub   Figure SEQ Figure \* ARABIC 1: GridControl with selected records Figure SEQ Figure \* ARABIC 2: Output screen Samples: C#: GetSelectedRowValues VB: GetSelectedRowValues  
How to retrieve the text from a cell in WinForms GridControl?
Retrieve the text You can retrieve the text from a cell by using the Text property, CellValue property or FormattedText property of the cell’s style object. Using GridModel C# int rowIndex = 2, colIndex = 3; // using Text property string cellText = gridControl1[rowIndex, colIndex].Text; // using CellValue property object cellTextValue = gridControl1[rowIndex, colIndex].CellValue; // using FormattedText property string formattedText= gridControl1[rowIndex, colIndex].FormattedText; VB Dim rowIndex As Integer = 2, colIndex As Integer = 3 ' using Text property Dim cellText As String = gridControl1(rowIndex, colIndex).Text ' using CellValue property Dim cellTextValue As Object = gridControl1(rowIndex, colIndex).CellValue ' using FormattedText property Dim formattedText As String= gridControl1(rowIndex, colIndex).FormattedText Using QueryCellInfo event C# //Hook the Events in Form_Load gridControl1.QueryCellInfo += gridControl1_QueryCellInfo; void gridControl1_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) {     // check for particular cell     if (e.RowIndex == 2 && e.ColIndex == 3)     {         string text = e.Style.Text;         object cellValue = e.Style.CellValue;         string formattedText = e.Style.FormattedText;     } } VB 'Hook the Events in Form_Load gridControl1.QueryCellInfo += gridControl1_QueryCellInfo Private Sub gridControl1_QueryCellInfo(ByVal sender As Object, ByVal e As GridQueryCellInfoEventArgs)    ' check for particular cell    If e.RowIndex = 2 AndAlso e.ColIndex = 3 Then        Dim text As String = e.Style.Text        Dim cellValue As Object = e.Style.CellValue        Dim formattedText As String = e.Style.FormattedText    End If End Sub   Note:Depending upon exactly what object is stored in the CellValue property, you have to perform the additional work to retrieve a ’usable value’ from the style. Refer to the specific examples regarding the ColorEdit control and the NumericUpDown controls in the Controls section of this FAQ.   Samples: C#: RetriveTextSample VB: RetriveTextSample  
No articles found
No articles found
1 of 1 pages (3 items)