本文整理汇总了C#中System.Windows.Forms.Label.Refresh方法的典型用法代码示例。如果您正苦于以下问题:C# Label.Refresh方法的具体用法?C# Label.Refresh怎么用?C# Label.Refresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Label
的用法示例。
在下文中一共展示了Label.Refresh方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetLabel
public void SetLabel(Label label, string text)
{
if (label.InvokeRequired)
{
SetLabelCallback d = new SetLabelCallback(SetLabel);
label.Invoke(d, new object[] { label, text });
}
else
{
label.Text = text;
label.Refresh();
Invalidate();
}
}
示例2: pasteAnswer
private void pasteAnswer(DataGridView dgwMatrix, Label lbl, string path)
{
StreamReader sr = File.OpenText(path);
int length = Convert.ToInt32(sr.ReadLine());
for (int i = 0; i < length; i++)
{
dgwMatrix.Columns.Add(Convert.ToString(i), Convert.ToString(i));
dgwMatrix.Columns[i].Width = (dgwMatrix.Width - 40) / length;
}
for (int i = 0; i < length; i++)
{
dgwMatrix.Rows.Add();
dgwMatrix.Rows[i].Height = (dgwMatrix.Height - 35) / length;
}
for (int i = 0; i < length; i++)
for (int j = 0; j < length; j++)
dgwMatrix.Rows[i].Cells[j].Value = sr.ReadLine();
string answer = "Під час виконання алгоритму виконується " + sr.ReadLine() + " ітерацій. ";
lbl.Text = answer;
lbl.Refresh();
sr.Close();
}
示例3: SetTextWithErr
public static void SetTextWithErr(Label lblMsg, string Message, bool isErr)
{
if (lblMsg.InvokeRequired)
{
lblMsg.Invoke(new SetText4LableWithErr(SetTextWithErr), new object[] { lblMsg, Message, isErr });
}
else
{
if (isErr)
{
lblMsg.ForeColor = Color.Red;
}
else
{
lblMsg.ForeColor = Color.DarkBlue;
}
lblMsg.Text = Message;
lblMsg.Refresh();
Thread.Sleep(5);
}
}
示例4: CreateLabel
public void CreateLabel()
{
Label lbl = new Label();
lbl.Parent = pnl;
lbl.MouseDown += new MouseEventHandler(MouseDown);
lbl.MouseMove += new MouseEventHandler(MouseMove);
lbl.Text = "Label";
lbl.ContextMenuStrip = pmElement;
lbl.Refresh();
TInterfaceElement item = new TInterfaceElement();
item.border = lbl;
item.ItemName = "Label";
item.BackColor = VGA_COLOR.VGA_BLACK;
item.FontColor = VGA_COLOR.VGA_WHITE;
Boolean err = true;
int i = 0;
while (err)
try
{
listitem.Add(item.ItemName, item);
lbl.Tag = item.ItemName;
err = false;
AddItem(item);
}
catch (Exception ee)
{
i++;
item.ItemName = "Label" + i.ToString();
}
}
示例5: UpdateFValueLegend
/// <summary>
/// フィールド値凡例の更新
/// </summary>
/// <param name="legendPanel"></param>
/// <param name="labelFreqValue"></param>
public void UpdateFValueLegend(Panel legendPanel, Label labelFreqValue)
{
if (Math.Abs(WaveLength) < Constants.PrecisionLowerLimit)
{
labelFreqValue.Text = "---";
}
else
{
labelFreqValue.Text = string.Format("{0:F3}", GetNormalizedFrequency());
}
// BUGFIX [次の周波数][前の周波数]ボタンで周波数が遅れて表示される不具合を修正
labelFreqValue.Refresh();
legendPanel.Refresh();
}
示例6: ShowEventStatus
public static void ShowEventStatus(Label lbl, string content)
{
try
{
if (lbl.InvokeRequired)
{
lbl.Invoke(new SetText(ShowEventStatus), new object[] { lbl, content });
}
else
{
lbl.Text = content;
lbl.Refresh();
}
}
catch
{
}
}
示例7: UpdLabel1
private void UpdLabel1(Label label)
{
if (count_btn == 1)
{
label.Paint -= new PaintEventHandler(paint_InfoLine);
}
label.Refresh();
label.Text = "";
label.Height = 17;
DateTime date = (DateTime)label.Parent.Tag;
if (holidayList != null && holidayList.Count > 0)//判断是否节假日
{
foreach (Holiday a in holidayList)
{
if (a.StartTime <= date.Date.Ticks && a.EndTime > date.Date.Ticks)
{
label.Text = a.Name;
return;
}
}
}
if (workDayList != null && workDayList.Count > 0)//判断是不是补班
{
foreach (WorkDay a in workDayList)
{
if (new DateTime (a.WorkDateTime).Date == date.Date)
{
label.Text ="补班";
return;
}
}
}
}
示例8: 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());
}
}
示例9: updateLabels
public void updateLabels(Label sensorFront, Label sensorLeft, Label sensorRight, List<Sensordata> list)
{
sensorFront.Text = list[0].frontValue.ToString();
sensorLeft.Text = list[0].leftValue.ToString();
sensorRight.Text = list[0].rightValue.ToString();
sensorFront.Refresh();
sensorLeft.Refresh();
sensorRight.Refresh();
}
示例10: ViewTextMessage
/// <summary>
/// 显示进度
/// </summary>
/// <param name="_path"></param>
/// <param name="message"></param>
private void ViewTextMessage(string _path, string message)
{
foreach (Control c in panel1.Controls)
{
if (c is PictureBox && ((PictureBox)c).ImageLocation == _path)
{
//找出对应的进度显示LABEL
Label _lab = new Label();
LinkLabel _linkLab = new LinkLabel();
string _name = "lab_Progress" + c.Name.Substring(c.Name.Length - 1);
string _linkName = "link_" + c.Name.Substring(c.Name.Length - 1);
foreach (Control x in panel1.Controls)
{
if (x.Name.Equals(_name))
{
_lab = (Label)x;
}
if (x.Name.Equals(_linkName))
{
_linkLab = (LinkLabel)x;
}
}
_lab.Text = message;
_lab.Visible = true;
_lab.Refresh();
_linkLab.Visible = false;
if (message.Contains("成功"))
{
if (ImgMangeWindowRefreshed != null)
{
ImgMangeWindowRefreshed(null, null);
}
((PictureBox)c).ImageLocation = null;
((PictureBox)c).Refresh();
_lab.Visible = false;
}
else if (message.Contains("已存在") || message.Contains("失败"))
{
_linkLab.Visible = true;
}
break;
}
}
bool _isFinish = true;
foreach (Control c in panel1.Controls)
{
if (c is Label && c.Name.Contains("Progress"))
{
if (c.Visible && c.Text.Contains("进度"))
{
_isFinish = false;
}
if (message.Contains("已停止"))
{
c.Text = "已停止";
}
}
}
if (_isFinish)
{
btn_Upload.Enabled = true;
}
}
示例11: CreateForm
/// <summary>Creates a form containing editable data</summary>
/// <param name="BindSrc">Binding source to use</param>
/// <param name="ParentControl">Control where to add items. A new panel is created there.</param>
/// <param name="MultiLineCols">Columns containig multiline data</param>
/// <param name="MultiFieldCols">Columns containing multiple data such as more than 1 objective, etc.</param>
/// <param name="ComboboxCols">Columns which should be combo boxes</param>
/// <param name="ComboboxItems">Data to populate each combobox</param>
public static void CreateForm(BindingSource BindSrc, Control ParentControl, List<string> MultiLineCols,
List<string> MultiFieldCols, List<string> ComboboxCols, List<List<string>> ComboboxItems)
{
//Creates a panel to hold everything
Panel panel = new Panel();
panel.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;
panel.Top = 0; panel.Left = 0;
panel.Width = ParentControl.Width; panel.Height = ParentControl.Height;
panel.AutoScroll = true;
ParentControl.Controls.Add(panel);
DataTable t = (DataTable)BindSrc.DataSource;
int top = 10;
int left = 40;
foreach (DataColumn c in t.Columns)
{
if (c.ColumnName != "Count")
{
Label lbl = new Label();
lbl.AutoSize = true;
lbl.Text = c.ColumnName;
lbl.Refresh();
lbl.Top = top + 3;
lbl.Left = left;
if (ComboboxCols != null && ComboboxCols.IndexOf(c.ColumnName) < 0)
{
TextBox txt = new TextBox();
txt.Top = top;
txt.Left = lbl.Left + lbl.Width + 220;
txt.Width = panel.Width / 2;
txt.DataBindings.Add("Text", BindSrc, c.ColumnName, false, DataSourceUpdateMode.OnPropertyChanged);
top = txt.Top + txt.Height + 10;
if (MultiLineCols.IndexOf(c.ColumnName) >= 0)
{
txt.Multiline = true;
txt.ScrollBars = ScrollBars.Vertical;
txt.Height = 120;
top = txt.Top + txt.Height + 10;
}
else if (MultiFieldCols.IndexOf(c.ColumnName) >= 0)
{
XMLFuncs.MultiField mf = new XMLFuncs.MultiField(txt, panel);
top = mf.GetNextTop() + 10;
}
panel.Controls.Add(txt);
}
else
{
//Combobox
ComboBox cmb = new ComboBox();
cmb.Top = top;
cmb.Left = lbl.Left + lbl.Width + 220;
cmb.Width = panel.Width / 2;
cmb.DataBindings.Add("Text", BindSrc, c.ColumnName, false, DataSourceUpdateMode.OnPropertyChanged);
top = cmb.Top + cmb.Height + 10;
//cmb.Font = new Font(cmb.Font.FontFamily, 10);
cmb.DropDownStyle = ComboBoxStyle.DropDownList;
foreach (string s in ComboboxItems[ComboboxCols.IndexOf(c.ColumnName)])
cmb.Items.Add(s);
panel.Controls.Add(cmb);
}
panel.Controls.Add(lbl);
}
}
}
示例12: SetColorErrorMessage
public static void SetColorErrorMessage(Label label, string message)
{
label.Text = message;
label.Refresh();
label.ResetForeColor();
label.BackColor = Color.White;
label.ForeColor = Color.DarkRed;
}
示例13: LoadFileList
internal void LoadFileList(string projectFileName, ImageList il, Label lbl)
{
ListFilename = projectFileName;
System.IO.TextReader tr = new System.IO.StreamReader(projectFileName);
string file = "";
file = tr.ReadLine();
while (file != null)
{
lbl.Text = "loading:" + file;
lbl.Refresh();
AddImage(file, il);
file = tr.ReadLine();
}
tr.Close();
}
示例14: setInputNumUpDown
//Method called every time a new numericUpDown (+ associated Label) has to be added to pnlPredInputs
public void setInputNumUpDown(int count, Variable curVariable)
{
NumericUpDown curNum = new NumericUpDown();
Label curLabel = new Label();
if (count == 0)
{
curNum = numPredInput0;
curNum.Visible = true;
curLabel = lblPredInp0;
curLabel.Visible = true;
}
else
{
//---- New numUpDown
curNum.Name = "numPredInput" + count.ToString();
curNum.TextAlign = numPredInput0.TextAlign;
curNum.Width = numPredInput0.Width;
curNum.Font = numPredInput0.Font;
curNum.Cursor = numPredInput0.Cursor;
curNum.ValueChanged += new System.EventHandler(numPredInput_ValueChanged);
pnlPredInputs.Controls.Add(curNum);
curNum.Location = new Point(numPredInput0.Location.X, numPredInput0.Location.Y + 50 * count);
//-----
//---- New Label
curLabel.Name = "lblPredInp" + count.ToString();
curLabel.Font = lblPredInp0.Font;
curLabel.ForeColor = lblPredInp0.ForeColor;
pnlPredInputs.Controls.Add(curLabel);
curLabel.Location = new Point(lblPredInp0.Location.X, lblPredInp0.Location.Y + 50 * count);
//----
}
curNum.Tag = curVariable;
updateMinMaxInputNum(curNum);
curLabel.Text = curVariable.input.displayedShortName + ":";
curLabel.Refresh();
}
示例15: LoadElements
public void LoadElements(System.Xml.XmlReader ids)
{
TInterfaceElement ie = new TInterfaceElement();
while (ids.Read())
if (ids.IsStartElement())
{
switch (ids.Name)
{
case "SCREEN_Width":
{
ids.Read();
Width = Convert.ToInt16(ids.Value);
}; break;
case "SCREEN_Height":
{
ids.Read();
Height = Convert.ToInt16(ids.Value);
}; break;
case "SCREEN_BackColor":
{
ids.Read();
BackColor = utftUtils.GetUTFTColor(ids.Value);
}; break;
case "SCREEN_FontColor":
{
ids.Read();
FontColor = utftUtils.GetUTFTColor(ids.Value);
}; break;
case "SCREEN_ABorderColor":
{
ids.Read();
ActiveBorderColor = utftUtils.GetUTFTColor(ids.Value);
}; break;
case "SCREEN_PBorderColor":
{
ids.Read();
PassiveBorderColor = utftUtils.GetUTFTColor(ids.Value);
}; break;
case "Desctop":
{
ids.Read();
Image = new System.Drawing.Bitmap(ids.Value);
};break;
case "Element":
ie = new TInterfaceElement();
break;
case "ItemType":
{
ids.Read();
switch (ids.Value)
{
case "Border":
{
Button btn = new Button();
btn.Parent = pnl;
btn.MouseDown += new MouseEventHandler(MouseDown);
btn.MouseMove += new MouseEventHandler(MouseMove);
btn.ContextMenuStrip = pmElement;
btn.Text = "Border";
btn.Refresh();
ie.border = btn;
} break; // button
case "2": break; // edit
case "Label":
{
Label lbl = new Label();
lbl.Parent = pnl;
lbl.MouseDown += new MouseEventHandler(MouseDown);
lbl.MouseMove += new MouseEventHandler(MouseMove);
lbl.Text = "Label";
lbl.ContextMenuStrip = pmElement;
lbl.Refresh();
ie.border = lbl;
} break; // label
case "4": break; // Checker
}
}
break;
case "ID": ids.Read(); ie.ID = Convert.ToByte(ids.Value); break;
case "ItemName": ids.Read(); ie.ItemName = ids.Value; listitem.Add(ie.ItemName, ie); AddItem(ie); break;
case "X": ids.Read(); ie.X = Convert.ToInt16(ids.Value); break;
case "Y": ids.Read(); ie.Y = Convert.ToInt16(ids.Value); break;
case "Width": ids.Read(); ie.width = Convert.ToInt16(ids.Value); break;
case "Height": ids.Read(); ie.heigth = Convert.ToInt16(ids.Value); break;
case "BackColor": ids.Read(); ie.BackColor = utftUtils.GetUTFTColor(ids.Value); break;
case "FontColor": ids.Read(); ie.FontColor = utftUtils.GetUTFTColor(ids.Value); break;
case "CanSelect": ids.Read(); ie.CanSelect = Convert.ToBoolean(ids.Value); break;
case "Text": ids.Read(); ie.Text = ids.Value; break;
}// ids.Name
}//while
}