当前位置: 首页>>代码示例>>C#>>正文


C# Label.Equals方法代码示例

本文整理汇总了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);
                }
            }
        }
开发者ID:CarlosRDomin,项目名称:HugeFileTransfer,代码行数:54,代码来源:Form1.cs

示例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");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:8,代码来源:LabelTest.cs

示例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;
        }
开发者ID:edwardsak,项目名称:homm,代码行数:9,代码来源:frmCastle.cs


注:本文中的System.Windows.Forms.Label.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。