作者ss0987316069 (Xagittarius)
看板C_Sharp
标题[问题] 如何将阵列值定时依序写入richtextbox?
时间Thu Jan 22 14:48:00 2015
目前程式的资料是要用来描绘图形的
阵列中共有100笔资料
我使用for回圈去跑
他会将100笔资料都显示在richtextbox中
但是图形只会描绘最後一个点
但是如果我一笔一笔资料去输入
图形就可以完整描绘出来
请问for回圈是不是只触发一次richtextbox所以才会只描绘出一个点
如果我要让我的阵列每隔0.5秒就依序显示一笔
(0.5秒>资料一>0.5秒>资料二>...这样)
并且每一笔都可以触发到使我的波形可以绘制
请问该怎麽做呢?
附上部分程式码 :
private void AddText(MsgType msgtype, string msg)
{
int data;
System.DateTime currentTime = new System.DateTime();
currentTime = System.DateTime.Now;
string now_ms = currentTime.Millisecond.ToString();
string strT = currentTime.ToString("u");
richTextBox1.Invoke(new EventHandler(delegate
{
//richTextBox1.SelectedText = string.Empty;
richTextBox1.SelectionFont = new Font(richTextBox1.SelectionFont, FontStyle.Bold);
richTextBox1.SelectionColor = MsgTypeColor[(int)msgtype];
richTextBox1.AppendText(msg);
data = Convert.ToInt32(msg); //转换型态
statusChart1.Value = data; //描绘图形值
richTextBox1.ScrollToCaret();
}));
}
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 120.96.55.53
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/C_Sharp/M.1421909283.A.CA6.html
※ 编辑: ss0987316069 (120.96.55.53), 01/22/2015 14:50:28