Hello, Telerik users.
There is one problem with me. Data must be entered in each corresponding cell, but data cannot be entered.I couldn't find the reason.
The source code is below.
It's a red syntax, but it doesn't work. Do you know why?
I really hope we can solve this problem.Thank you.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Collections;
namespace TEST
{
public partial class ViewerControl2 : UserControl
{
protected bool IsDesignMode { get { return DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime; } }
private const int ROWCOUNT = 100;
private const int COLUMNCOUNT = 100;
public ViewerControl2()
{
try
{
InitializeComponent();
if (IsDesignMode) return;
SetLayout();
SetEventHandler();
}
catch (Exception ex)
{
throw ex;
}
}
private void SetLayout()
{
try
{
this.radGridView1.ShowGroupPanel = false;
this.radGridView1.VirtualMode = true;
this.radGridView1.RowCount = 5;
this.radGridView1.ColumnCount = 19;
//this.radGridView1.BackColor = Color.Transparent;
this.radGridView1.ReadOnly = true;
this.radGridView1.TableElement.DrawFill = false;
this.radGridView1.TableElement.RowHeight = 50;
this.radGridView1.TableElement.CellSpacing = 0;
this.radGridView1.MasterTemplate.ShowRowHeaderColumn = true;
this.radGridView1.MasterTemplate.ShowColumnHeaders = true;
this.radGridView1.MasterTemplate.AllowAddNewRow = false;
createData();
}
catch (Exception ex)
{
throw ex;
}
}
private void SetEventHandler()
{
try
{
}
catch (Exception ex)
{
throw ex;
}
}
private void createData()
{
string getData = "SEND;BIT;1;0;0;1;1;0;1;1;1;1;1;1;1;1;1;1;1;1;0;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;0;1;1;1;1;1;1;1;1;1;1;1;0;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;0;0;1;1;1;0";
string[] spstring = getData.Split(';');
int dataLength = (spstring.Length - 2);
int horizontal_length = dataLength / 5;
string[,] lineData = new string[5, horizontal_length];
int startData = 2;
for (int j = 0; j < horizontal_length; j++) {
for (int i = 4; i > -1; i--) {
lineData[i, j] = spstring[startData++];
}
}
for (int i = 0; i < 5; i++) {
for (int j = 0; j < horizontal_length; j++) {
this.radGridView1.Rows[i].Cells[j].Style.CustomizeFill = true;
this.radGridView1.Rows[i].Cells[j].Style.DrawFill = true;
this.radGridView1.Columns[j].HeaderText = j.ToString();
if (lineData[i, j] == "1") {
this.radGridView1.Rows[i].Cells[j].Value = 1;
this.radGridView1.Rows[i].Cells[j].Style.BackColor = Color.Green;
} else {
this.radGridView1.Rows[i].Cells[j].Value = 0;
this.radGridView1.Rows[i].Cells[j].Style.BackColor = Color.Black;
}
}
}
}
}
}