我有兩個GridListControl窗口有5行3列,我已經在每個單元格中輸入了一些硬編碼值,但我想通過使用Random
和Timer
在每個單元格中動態更新它。 我從Here:經過,但沒有清除我的概念。如何在C#中的GridListControl中隨機生成單元格數據?
如何整合Random
和Timer
與我的代碼?
請幫忙。我的代碼
部分低於:
namespace First_Form_Demo
{
public partial class Form1 : Form
{
List<Tuple<int, int, double>> list_Tuple_BuySideDepth = null;
List<Tuple<double, int, int>> list_Tuple_BuySideDepth1 = null;
public Form1()
{
InitializeComponent();
Init();
}
private void Init()
{
// For GridListControl1.
list_Tuple_BuySideDepth = new List<Tuple<int, int, double>>();
list_Tuple_BuySideDepth.Add(new Tuple<int, int, double>(3, 451, 67.0050));
list_Tuple_BuySideDepth.Add(new Tuple<int, int, double>(9, 655, 67.0025));
list_Tuple_BuySideDepth.Add(new Tuple<int, int, double>(17, 2045, 67.0000));
list_Tuple_BuySideDepth.Add(new Tuple<int, int, double>(22, 2080, 66.9875));
list_Tuple_BuySideDepth.Add(new Tuple<int, int, double>(23, 1564, 66.9950));
// For GridListControl2.
list_Tuple_BuySideDepth1 = new List<Tuple<double, int, int>>();
list_Tuple_BuySideDepth1.Add(new Tuple<double, int, int>(67.0075, 813, 10));
list_Tuple_BuySideDepth1.Add(new Tuple<double, int, int>(67.0100, 1255, 28));
list_Tuple_BuySideDepth1.Add(new Tuple<double, int, int>(67.0125, 715, 13));
list_Tuple_BuySideDepth1.Add(new Tuple<double, int, int>(67.0150, 1687, 19));
list_Tuple_BuySideDepth1.Add(new Tuple<double, int, int>(67.0175, 1612, 24));
}
}
private void Form1_Load(object sender, EventArgs e)
{
MaximizeBox = false;
MinimizeBox = false;
if (true)
{
gridListControl1.MultiColumn = true;
gridListControl1.ForeColor = Color.Red;
gridListControl1.DataSource = list_Tuple_BuySideDepth;
this.gridListControl1.Grid.HScrollBehavior = Syncfusion.Windows.Forms.Grid.GridScrollbarMode.Disabled;//GridScrollbarMode.Disabled;
gridListControl2.MultiColumn = true;
gridListControl2.ForeColor = Color.Red;
gridListControl2.DataSource = list_Tuple_BuySideDepth;
this.gridListControl2.Grid.HScrollBehavior = Syncfusion.Windows.Forms.Grid.GridScrollbarMode.Disabled;
}
}
我做你的方式,但錯誤就這樣產生'財產或索引器系統。不能將其分配給 - 它只能讀取。 如何解決它? –
嗨,我以你的方式做了。謝謝你。 另外一個問題我已經知道如何在上面的程序中禁用'grid list control'中的垂直滾動條。 請建議。 –
看看這個鏈接:https://www.syncfusion.com/kb/6659/how-to-hide-horizontal-scroll-bars-in-gridlistcontrol – Fruchtzwerg