本文整理汇总了C#中System.Windows.Forms.TextBox.AppendText方法的典型用法代码示例。如果您正苦于以下问题:C# TextBox.AppendText方法的具体用法?C# TextBox.AppendText怎么用?C# TextBox.AppendText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.TextBox
的用法示例。
在下文中一共展示了TextBox.AppendText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FillMemo
public static void FillMemo(TextBox lb, List<string> list)
{
lb.Clear();
foreach(var s in list) {
if (lb.Text.Length > 0)
lb.AppendText(Environment.NewLine);
lb.AppendText(s);
}
}
示例2: PrintMatrix
public void PrintMatrix(TextBox tb)
{
for (int i = 0; i < P; i++) {
for (int j = 0; j < N; j++) {
tb.AppendText(A[i,j] + " ");
}
tb.AppendText("\n");
}
for (int i = 0; i < P; i++) {
tb.AppendText(B[i] + "\n");
}
}
示例3: printOutResult
public void printOutResult(List<string> resultStrings, TextBox textbox)
{
textbox.Text = "";
if (resultStrings.Count() == 0)
{
textbox.AppendText("No Result");
return;
}
foreach (string resultString in resultStrings)
{
textbox.AppendText(resultString + Environment.NewLine);
}
}
示例4: OnDataReceived
private void OnDataReceived(object sender, EventArgs e)
{
Device d = (Device)sender;
TextBox lm_value = new TextBox();
lm_value.Text = "datarecieved";
Device.DataEventArgs de = (Device.DataEventArgs)e;
NeuroSky.ThinkGear.DataRow[] tempDataRowArray = de.DataRowArray;
TGParser tgParser = new TGParser();
tgParser.Read(de.DataRowArray);
//bool hasBlink = false;
//int blinkeye = 0;
/* Loops through the newly parsed data of the connected headset*/
// The comments below indicate and can be used to print out the different data outputs.
// for (int i = 0; i < tgParser.ParsedData.Length; i++)
// {
// if (radio_att.Checked == true & tgParser.ParsedData[i].ContainsKey("Attention")
// )
// {
//
// updateAttentionMode(tgParser, i);
//
// }
// else if (radio_me.Checked == true & tgParser.ParsedData[i].ContainsKey("Meditation")
// )
// {
// updateMediationMode(tgParser, i);
// }
//
// }
for (int i = 0; i < tgParser.ParsedData.Length; i++)
{
if (tgParser.ParsedData[i].ContainsKey("Attention"))
{
lm_value.AppendText("Att Value:" + tgParser.ParsedData[i]["Attention"]);
Equals("Att Value:" + tgParser.ParsedData[i]["Attention"]);
}
if (tgParser.ParsedData[i].ContainsKey("Meditation"))
{
lm_value.AppendText("Med Value:" + tgParser.ParsedData[i]["Meditation"]);
Equals("Med Value:" + tgParser.ParsedData[i]["Meditation"]);
}
}
}
示例5: cyberplatProcessing
/// <summary>
/// Этот метод производит обработку данных ПС киберплат. На вход подается массив ссылок на киберплат Links.
/// Остальные три параметра - граф. эл-ты соответсвующего типа.
/// </summary>
/// <param name="Links">Массив ссылок на киберплат</param>
/// <param name="dataBox">Поле, в которое выводится лог.</param>
/// <param name="progress">Прогресбар 1</param>
/// <param name="progress2">Прогресбар 2</param>
/// <returns>Возвращает сумму за текущий час в строковом формате с запятой.</returns>
public static string cyberplatProcessing(string[] Links, TextBox dataBox, ProgressBar progress, ProgressBar progress2)//обработка киберплата
{
double summa = 0;
string tmpTime = "";
string s1 = "";
string s2 = "";
string s3 = "";
string s4 = "";
for (int i = 0; i < 20; i++)
{
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");
NumberStyles styles;
styles = NumberStyles.AllowParentheses | NumberStyles.AllowTrailingSign | NumberStyles.Float | NumberStyles.AllowThousands;
tmpTime = cybertime;
if (tmpTime != "") { s3 = tmpTime.Remove(3, 2); }
s1 = Downloader.Download(Links[i]);
s2 = s1.Substring(s1.IndexOf("Всего") + 228, 100); //поиск слова "Всего" в документе и сдвиг на 228 символов от него(несколько строк вниз) и выемка 50 символов
Regex regex = new Regex("([0-9]+.+[0-9])"); //регулярка для поиска числа в строке
Match match = regex.Match(s2);
if (match.Value != "")
{
summa = summa + Double.Parse(match.Value, styles);
dataBox.AppendText(regions[i] + "\n");
dataBox.AppendText(match.Value + "\n");// вывод в textBox2
dataBox.AppendText((s1.Substring(s1.IndexOf("Данные отчета актуальны"), 49)).Replace("<b> ", " ") + "\n");
dataBox.AppendText("\n");
cybertime = ((s1.Substring(s1.IndexOf("Данные отчета актуальны")+44, 5)));
if (cybertime != "") { s4 = cybertime.Remove(3, 2); }
if (i >0 & s3 != s4)
{
progress.Value = 0;
progress2.Value = 0;
return cyberplatProcessing(Links, dataBox, progress, progress2);
}
}
else
{
summa = summa + 0;
dataBox.AppendText(regions[i] + "\n");
dataBox.AppendText("0.00" + "\n");
dataBox.AppendText("Отчёт ещё не сформирован" + "\n");
dataBox.AppendText("\n");
}
progress.PerformStep();
progress2.PerformStep();
}
dataBox.AppendText("Данные сняты");
string result = (summa.ToString()).Replace(".", ",");//замена точки на запятую(для удобства)
return result;
}
示例6: PrintRadacini
public void PrintRadacini(TextBox tb)
{
tb.Clear();
for (int i = 0; i < radacini.Count; i++) {
tb.AppendText(radacini[i] + "\n");
}
}
示例7: StartAnomalyDetection
public static void StartAnomalyDetection(TextBox warningTextBox)
{
if (DoneSettingNormalUsage)
{
if (CPUMonitor.CPUCounter > NormalCPU)
{
if (warningTextBox.Text.Length == 0)
{
warningTextBox.Invoke(new Action(() =>
{
warningTextBox.Text = "CPU Usage: " + CPUMonitor.CPUCounter.ToString("F2") + "%";
CPUMonitor.CPUWarnings = warningTextBox.Text;
}));
}
else
{
warningTextBox.Invoke(new Action(() =>
{
warningTextBox.AppendText("\r\nCPU Usage: " + CPUMonitor.CPUCounter.ToString("F2") + "%");
CPUMonitor.CPUWarnings = warningTextBox.Text;
}));
}
}
}
}
示例8: part3
//part3 поиск по маске рлецб p2[3] + p2[2] + * + p2[7] + p2[1]
public string part3(string str3,string strch,TextBox txtbox)
{
//должна вернуть слово(список слов)
System.IO.StringReader file = new System.IO.StringReader(Properties.Resources.Dictionary);
string line="";
string tmp3="";
string res = str3+"(";
int ctr = 0;
string toTxt3 = strch + " - ";
while ((line = file.ReadLine()) != null)
{
tmp3 = line.Trim();
if(tmp3.Length == 5)
{
if (tmp3[0] == str3[3] && tmp3[1] == str3[2] && tmp3[3] == str3[7] && tmp3[4] == str3[1])
{
res = res + tmp3 + ", ";
toTxt3 = toTxt3 + part4(tmp3);//+
ctr++;
}
}
}
if (toTxt3 != strch + " - ")
{
txtbox.AppendText(toTxt3 + "\r\n");
}
if (ctr == 0) { res = ""; }
else {
res = res.Substring(0, res.Length - 2) + "),";
}
return res;
}
示例9: ProcessMonitoring
public static async void ProcessMonitoring(TextBox usageTextBox, TextBox listTextBox)
{
int changed = ProcessCounter;
string[] data;
while (true)
{
await Task.Delay(1000);
CurrentNumberProcesses();
usageTextBox.Invoke(new Action(() =>
{
usageTextBox.Text = ProcessCounter + "";
}));
if (changed != ProcessCounter)
{
changed = ProcessCounter;
listTextBox.Invoke(new Action(() =>
{
data = ReadProcesses();
foreach (string pData in data)
{
if (listTextBox.Text.Length < 0)
listTextBox.Text = pData;
else
listTextBox.AppendText($"\r\n{pData}");
}
}));
}
}
}
示例10: ScriptChecks
static public void ScriptChecks(ref TextBox textbox, ref ToolStripProgressBar ProgressBar)
{
string[] src = FileSystemUtil.GetAllFileNames((string)Settings.Global.Properties["POLPath"], "*.src");
string[] ecl = FileSystemUtil.GetAllFileNames((string)Settings.Global.Properties["POLPath"], "*.ecl");
string[] asp = FileSystemUtil.GetAllFileNames((string)Settings.Global.Properties["POLPath"], "*.asp");
ScriptCount.Add("ECL", ecl.Length);
ScriptCount.Add("SRC", src.Length);
ScriptCount.Add("ASP", asp.Length);
if (ecl.Length < src.Length)
textbox.AppendText("* Warning: Not all scripts are compiled." + Environment.NewLine);
else if (ecl.Length > src.Length)
textbox.AppendText("* Warning: There are more ecl files than src files." + Environment.NewLine);
else
textbox.AppendText("* Pass: All scripts are compiled." + Environment.NewLine);
textbox.AppendText("Found " + src.Length.ToString() + " .src files and " + ecl.Length.ToString() + " .ecl files." + Environment.NewLine);
ProgressBar.PerformStep();
}
示例11: add_text
public static void add_text(TextBox tb, object s)
{
if (tb.InvokeRequired)
tb.Invoke(new Action<TextBox, object>(add_text), new object[] { tb, s });
else
{
tb.AppendText(s.ToString());
tb.ScrollToCaret();
}
}
示例12: ConnectToHopper
public void ConnectToHopper(TextBox log = null)
{
// setup timer
System.Windows.Forms.Timer reconnectionTimer = new System.Windows.Forms.Timer();
reconnectionTimer.Tick += new EventHandler(reconnectionTimer_Tick);
reconnectionTimer.Interval = 1000; // ms
int attempts = 10;
// Setup connection info
Hopper.CommandStructure.ComPort = Global.ComPort;
Hopper.CommandStructure.SSPAddress = Global.Validator2SSPAddress;
Hopper.CommandStructure.BaudRate = 9600;
Hopper.CommandStructure.Timeout = 1000;
Hopper.CommandStructure.RetryLevel = 3;
// Run for number of attempts specified
for (int i = 0; i < attempts; i++)
{
if (log != null) log.AppendText("Trying connection to SMART Hopper\r\n");
// turn encryption off for first stage
Hopper.CommandStructure.EncryptionStatus = false;
// if the key negotiation is successful then set the rest up
if (Hopper.OpenPort() && Hopper.NegotiateKeys(log))
{
Hopper.CommandStructure.EncryptionStatus = true; // now encrypting
// find the max protocol version this validator supports
byte maxPVersion = FindMaxHopperProtocolVersion();
if (maxPVersion >= 6)
Hopper.SetProtocolVersion(maxPVersion, log);
else
{
MessageBox.Show("This program does not support slaves under protocol 6!", "ERROR");
return;
}
// get info from the validator and store useful vars
Hopper.SetupRequest(log);
// inhibits, this sets which channels can receive notes
Hopper.SetInhibits(log);
// set running to true so the hopper begins getting polled
hopperRunning = true;
return;
}
// reset timer
reconnectionTimer.Enabled = true;
while (reconnectionTimer.Enabled)
{
if (CHelpers.Shutdown)
return;
Application.DoEvents();
}
}
}
示例13: AppendText
private void AppendText(TextBox txtBox, String txt)
{
if (this.InvokeRequired)
{
this.Invoke(new DelegateAppendText(AppendText), new object[] { txtBox, txt });
}
else
{
txtBox.AppendText(txt);
}
}
示例14: AppendText
public void AppendText(TextBox ctl, string txt)
{
if (this.InvokeRequired)
{
this.Invoke(new DelegateShowText(AppendText), new object[] { ctl, txt });
}
else
{
ctl.AppendText(txt);
}
}
示例15: SetTextBoxValue
private void SetTextBoxValue(string value, TextBox ctr)
{
Action<string> setValueAction = text => ctr.AppendText(value);//Action<T>本身就是delegate类型,省掉了delegate的定义
if (ctr.InvokeRequired)
{
ctr.Invoke(setValueAction, value);
}
else
{
setValueAction(value);
}
}