本文整理汇总了C#中System.Windows.Forms.Label.Update方法的典型用法代码示例。如果您正苦于以下问题:C# Label.Update方法的具体用法?C# Label.Update怎么用?C# Label.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Label
的用法示例。
在下文中一共展示了Label.Update方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetLabelText
string SetLabelText(Label label,
string strText)
{
string strOldText = label.Text;
label.Text = strText;
label.Update();
return strOldText;
}
示例2: UpdateStatus
private void UpdateStatus(Label lbl, string status)
{
if (lbl.InvokeRequired)
{
lbl.BeginInvoke(new Action<Label, string>(UpdateStatus), lbl, status);
}
else
{
lbl.Text = status;
lbl.Update();
lbl.Parent.Update();
}
}
示例3: Safe_SetLabelText
// 线程安全版本
string Safe_SetLabelText(Label label,
string strText)
{
if (label.Parent != null && label.Parent.InvokeRequired)
{
Delegate_SetLabelText d = new Delegate_SetLabelText(SetLabelText);
return (string)label.Parent.Invoke(d, new object[] { label, strText });
}
else
{
string strOldText = label.Text;
label.Text = strText;
label.Update();
return strOldText;
}
}
示例4: initFrequencyBox
/// <summary>
/// Loads the frequency edit controls
/// </summary>
/// <param name="xPos">The X position where the controls should be placed</param>
/// <param name="yPos">The Y position where the controls should be placed</param>
private void initFrequencyBox(int xPos, int yPos)
{
frequencyLabel = new Label();
frequencyLabel.Font = new System.Drawing.Font(frequencyLabel.Font.FontFamily, frequencyLabel.Font.Size + 0.4f, System.Drawing.FontStyle.Bold);
frequencyLabel.Text = "frequency:";
frequencyLabel.Size = new System.Drawing.Size(75, 16);
frequencyLabel.Location = new Point(5 , yPos + 1);
frequencyLabel.Update();
frequencyLabel.AutoSize = false;
frequencyBox = new TextBox();
frequencyBox.Size = new Size(60, 20);
frequencyBox.Location = new Point(frequencyLabel.Location.X + frequencyLabel.Size.Width + 3, yPos);
frequencyBox.Text = synchronousPwmFrequency.ToString();
frequencyBox.TextChanged += new EventHandler(frequencyChangedHandler);
frequencyBox.KeyDown += new KeyEventHandler(frequencySettings_KeyDown);
fUnitsBox = new ComboBox();
fUnitsBox.Size = new Size(45, 21);
fUnitsBox.Location = new Point(frequencyBox.Location.X + frequencyBox.Size.Width + 3, yPos);
fUnitsBox.DropDownStyle = ComboBoxStyle.DropDownList;
fUnitsBox.Items.Add("Hz");
fUnitsBox.Items.Add("KHz");
fUnitsBox.Text = "Hz";
fUnitsBox.SelectedIndexChanged += new EventHandler(frequencyChangedHandler);
fUnitsBox.KeyDown += new KeyEventHandler(frequencySettings_KeyDown);
this.Controls.Add(frequencyLabel);
this.Controls.Add(frequencyBox);
this.Controls.Add(fUnitsBox);
}
示例5: SetMessageText
public void SetMessageText(string text)
{
try
{
Label lblActionResult = new System.Windows.Forms.Label();
//
lblActionResult.AutoSize = true;
lblActionResult.Location = new System.Drawing.Point(12, 283);
lblActionResult.Name = "lblActionResult";
lblActionResult.Size = new System.Drawing.Size(0, 13);
lblActionResult.TabIndex = 0;
lblActionResult.Visible = false;
{
this.Invoke(new MethodInvoker(delegate()
{
lblActionResult.Text = text;
lblActionResult.Visible = true;
lblActionResult.Refresh();
lblActionResult.Update();
this.Refresh();
this.Update();
}));
this.Invoke(new MethodInvoker(delegate() { this.Controls.Add(lblActionResult); }));
Thread t = new Thread(delegate()
{
try
{
Thread.Sleep(5000);
this.Invoke(new MethodInvoker(delegate()
{
this.Controls.Remove(lblActionResult);
}));
}
catch (Exception ex)
{
Tools.Instance.Logger.LogError(ex.ToString());
}
});
t.Start();
}
}
catch (Exception ex)
{
Tools.Instance.Logger.LogError(ex.ToString());
}
}
示例6: createDynels
public void createDynels(FunctionTemplates templ)
{
string dummystring = "";
int dummyint = 0;
Single dummysingle = 0.0f;
LineValue dummyline = new LineValue();
PlayfieldValue dummypf = new PlayfieldValue();
template = templ;
int y = 20;
int i = 0;
foreach (FunctionTemplate ft in templ.Templates)
{
if (ft.DataType == dummystring.GetType())
{
Label lab = new Label();
lab.Parent = this;
lab.Left = 20;
lab.Top = y+3;
lab.Text = ft.name + ":";
lab.Name = "Lab" + i;
lab.AutoSize = true;
lab.Update();
TextBox ed = new TextBox();
ed.Parent = this;
ed.Left = 20;
ed.Text = ft.baseValue;
ed.Top = y;
ed.Name = "Ed" + i;
ed.Height = 20;
ed.Width = 200;
ed.Enabled = !ft.ro;
Panel p = new Panel();
p.Parent = this;
p.Left = 0;
p.Width = this.Width;
p.Height = 1;
p.Top = y + 25;
p.BackColor = Color.DarkGray;
y += 30;
i++;
}
else
if (ft.DataType == dummypf.GetType())
{
Label lab = new Label();
lab.Parent = this;
lab.Left = 20;
lab.Top = y + 3;
lab.Text = ft.name + ":";
lab.Name = "Lab" + i;
lab.AutoSize = true;
lab.Update();
TextBox ed = new TextBox();
ed.Parent = this;
ed.Name = "Ed" + i;
ed.Top = y;
ed.Text = ft.baseValue;
ed.Left = 20;
ed.Height = 20;
ed.Enabled = false;
Button b = new Button();
b.Parent = this;
b.Text = "Choose PF";
b.Left = 20;
b.Enabled = !ft.ro;
b.Top = y-1;
b.MouseClick += pfbutton;
b.Name = "but" + i;
Panel p = new Panel();
p.Parent = this;
p.Left = 0;
p.Width = this.Width;
p.Height = 1;
p.Top = y + 25;
p.BackColor = Color.DarkGray;
y += 30;
i++;
}
else
if (ft.DataType == dummyint.GetType())
{
Label lab = new Label();
lab.Parent = this;
lab.Left = 20;
lab.Top = y+3;
lab.Text = ft.name + ":";
lab.Name = "Lab" + i;
lab.AutoSize = true;
lab.Update();
//.........这里部分代码省略.........
示例7: LChangeItemStatus
private void LChangeItemStatus(Label label, String strText)
{
label.Text = strText;
label.Refresh();
label.Update();
}
示例8: showMotorState
/// <summary>
/// Zobrazí stav konkrétního motoru
/// </summary>
/// <param name="motorView">vizualizace motoru</param>
/// <param name="state">stav</param>
/// <param name="message">zpráva ke stavu</param>
/// <param name="motorId">id motoru</param>
private void showMotorState(Label motorView, MotorState state, String message, MotorId motorId, int speed, int position) {
switch (state)
{
case MotorState.error:
motorView.BackColor = Color.Red;
break;
case MotorState.enabled:
motorView.BackColor = Color.Green;
break;
case MotorState.disabled:
motorView.BackColor = Color.LightSlateGray;
break;
case MotorState.running:
motorView.BackColor = Color.Orange;
break;
}
this.Invoke((MethodInvoker)delegate
{
((Label)motorView.GetChildAtPoint(new Point(0,0))).Text = speed.ToString();
motorView.Text = position.ToString();
toolTip.SetToolTip(motorView, "ID motoru: " + motorId + "\nStav motoru: " + state + "\nZpráva: " + message);
motorView.Update();
});
}