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


C# Padding.ToString方法代码示例

本文整理汇总了C#中System.Windows.Forms.Padding.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Padding.ToString方法的具体用法?C# Padding.ToString怎么用?C# Padding.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.Padding的用法示例。


在下文中一共展示了Padding.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PaddingPropertiesTest

		public void PaddingPropertiesTest()
		{
			Padding pad = new Padding();
			Assert.AreEqual(-1, pad.All, "#A1");
			Assert.AreEqual(0, pad.Top, "#A2");
			Assert.AreEqual(0, pad.Left, "#A3");
			Assert.AreEqual(0, pad.Right, "#A4");
			Assert.AreEqual(0, pad.Bottom, "#A5");
			Assert.AreEqual(0, pad.Horizontal, "#A6");
			Assert.AreEqual(0, pad.Vertical, "#A7");
			Assert.AreEqual("{Left=0,Top=0,Right=0,Bottom=0}", pad.ToString(), "#A8");
			Assert.AreEqual(new Size(0,0), pad.Size, "#A9");

			Padding pad2 = new Padding(5);
			Assert.AreEqual(5, pad2.All, "#B1");
			Assert.AreEqual(5, pad2.Top, "#B2");
			Assert.AreEqual(5, pad2.Left, "#B3");
			Assert.AreEqual(5, pad2.Right, "#B4");
			Assert.AreEqual(5, pad2.Bottom, "#B5");
			Assert.AreEqual(10, pad2.Horizontal, "#B6");
			Assert.AreEqual(10, pad2.Vertical, "#B7");
			Assert.AreEqual("{Left=5,Top=5,Right=5,Bottom=5}", pad2.ToString(), "#B8");
			Assert.AreEqual(new Size(10, 10), pad2.Size, "#B9");

			Padding pad3 = new Padding(5, 5, 10, 10);
			Assert.AreEqual(-1, pad3.All, "#C1");
			Assert.AreEqual(5, pad3.Top, "#C2");
			Assert.AreEqual(5, pad3.Left, "#C3");
			Assert.AreEqual(10, pad3.Right, "#C4");
			Assert.AreEqual(10, pad3.Bottom, "#C5");
			Assert.AreEqual(15, pad3.Horizontal, "#C6");
			Assert.AreEqual(15, pad3.Vertical, "#C7");
			Assert.AreEqual("{Left=5,Top=5,Right=10,Bottom=10}", pad3.ToString(), "#C8");
			Assert.AreEqual(new Size(15, 15), pad3.Size, "#C9");

			Padding pad4 = new Padding(10, 10, 10, 10);
			Assert.AreEqual(10, pad4.All, "#D1");

			Padding pad5 = Padding.Empty;
			Assert.AreEqual(0, pad5.All, "#E1");
			Assert.AreEqual(0, pad5.Top, "#E2");
			Assert.AreEqual(0, pad5.Left, "#E3");
			Assert.AreEqual(0, pad5.Right, "#E4");
			Assert.AreEqual(0, pad5.Bottom, "#E5");
			Assert.AreEqual(0, pad5.Horizontal, "#E6");
			Assert.AreEqual(0, pad5.Vertical, "#E7");
			Assert.AreEqual("{Left=0,Top=0,Right=0,Bottom=0}", pad5.ToString(), "#E8");
			Assert.AreEqual(new Size(0, 0), pad5.Size, "#E9");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:49,代码来源:PaddingTest.cs


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