本文整理汇总了C#中System.Windows.Forms.Label.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Label.Equals方法的具体用法?C# Label.Equals怎么用?C# Label.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Label
的用法示例。
在下文中一共展示了Label.Equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: formatResults
private void formatResults(Label lbl, object value)
{
if (lbl.Equals(lblResKBps)) {
double KBps = (double)value;
if (KBps < 0) {
lblResKBps.Text = "N/A";
}else if (KBps < 950) {
lblResKBps.Text = String.Format("{0:#,#0.0#} KB/s", KBps);
} else {
lblResKBps.Text = String.Format("{0:#,#0.0#} MB/s", KBps / 1000);
}
} else if (lbl.Equals(lblResRemaining)) {
double remaining = (double)value;
string temp = "";
if (remaining < 0) {
lblResRemaining.Text = "N/A";
} else if (double.IsPositiveInfinity(remaining) || double.IsNegativeInfinity(remaining)) {
lblResRemaining.Text = "Infinito";
} else {
temp = String.Format("{0:0}s", remaining % 60);
remaining = Math.Floor(remaining / 60);
if (remaining > 0) temp = String.Format("{0:0}m", remaining % 60) + temp;
remaining = Math.Floor(remaining / 60);
if (remaining > 0) temp = String.Format("{0:0}h", remaining % 24) + temp;
remaining = Math.Floor(remaining / 24);
if (remaining > 0) temp = String.Format("{0:0}d", remaining % 365) + temp;
remaining = Math.Floor(remaining / 365);
if (remaining > 0) temp = String.Format("{0:0}a", remaining) + temp;
lblResRemaining.Text = temp;
}
} else if (lbl.Equals(lblResCurrentSize)) {
Int64 currentSize = (Int64)value;
if (currentSize < 0) {
lblResCurrentSize.Text = "N/A";
}else if (currentSize < 1000000) {
lblResCurrentSize.Text = String.Format("{0:0.00} KB", currentSize / 1000.0);
} else if (currentSize < 1000000000) {
lblResCurrentSize.Text = String.Format("{0:0.00} MB", currentSize / 1000000.0);
} else {
lblResCurrentSize.Text = String.Format("{0:#,#0.00} GB", currentSize / 1000000000.0);
}
} else if (lbl.Equals(lblResProgress)) {
double progress = (double)value;
if (double.IsNaN(progress) || progress < 0) {
progBarUpload.Value = 0;
lblResProgress.Text = "N/A";
} else {
progress = Math.Max(0, Math.Min(100, progress));
progBarUpload.Value = (int)Math.Round(progress);
lblResProgress.Text = String.Format("{0:0.00} %", progress);
}
}
}
示例2: LabelEqualsTest
public void LabelEqualsTest () {
Label s1 = new Label ();
Label s2 = new Label ();
s1.Text = "abc";
s2.Text = "abc";
Assert.IsFalse (s1.Equals (s2), "#69");
Assert.IsTrue (s1.Equals (s1), "#70");
}
示例3: FindSlotNo
private int FindSlotNo(Label[] txtBoxs, Label txtBox)
{
for (int i = 0; i < txtBoxs.Length; i++)
{
if (txtBox.Equals(txtBoxs[i])) return i;
}
return -1;
}