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


C# Size.Equals方法代码示例

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


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

示例1: Equals

		public void Equals ()
		{
			Size s = new Size (10, 20);

			Assert.IsTrue (s.Equals (s));
			Assert.IsTrue (s.Equals (new Size (10, 20)));

			Assert.IsTrue (Size.Equals (s, s));

			Assert.IsFalse (s.Equals (new Size (5, 10)));
			Assert.IsFalse (Size.Equals (s, new Size (5, 10)));

			Assert.IsFalse (s.Equals (new object()));
		}
开发者ID:nobled,项目名称:mono,代码行数:14,代码来源:SizeTest.cs

示例2: QuasiEquality

		public void QuasiEquality ()
		{
			Size expected = new Size (25, 25);
			Size actual = new Size (25.000000000000001, 25.000000000000001);
			Assert.IsTrue (expected.Equals (actual), "Equals(Size)");
			Assert.IsTrue (actual.Equals ((object)expected), "Equals(object)");

			actual = new Size (25.00000000000001, 25.00000000000001);
			Assert.IsFalse (expected.Equals (actual), "not-Equals(Size)");
			Assert.IsFalse (actual.Equals ((object) expected), "not-Equals(object)");
		}
开发者ID:dfr0,项目名称:moon,代码行数:11,代码来源:SizeTest.cs

示例3: MeasureOverride

        protected override Size MeasureOverride(Size availableSize)
        {
            var idealSize = new Size(0, 0);

            // Allow children as much room as they want - then scale them
            var size = new Size(Double.PositiveInfinity, Double.PositiveInfinity);
            foreach (UIElement child in Children)
            {
                child.Measure(size);
                // first card gets full width, following cards only ask for a fraction to keep scroller reasonable; they take up more if available
                if (idealSize.Equals(new Size(0, 0))) idealSize.Width += child.DesiredSize.Width;
                else idealSize.Width += child.DesiredSize.Width / 3;

                idealSize.Height = Math.Max(idealSize.Height, child.DesiredSize.Height);
            }

            // EID calls us with infinity, but framework doesn't like us to return infinity
            if (double.IsInfinity(availableSize.Height) || double.IsInfinity(availableSize.Width))
                return idealSize;
            return availableSize;
        }
开发者ID:sbarnabas,项目名称:OCTGN,代码行数:21,代码来源:FanPanel.cs

示例4: CreateOffscreenBrowser

        /// <summary>
        /// Create the underlying Browser instance, can be overriden to defer control creation
        /// The browser will only be created when size &gt; Size(0,0). If you specify a positive
        /// size then the browser will be created, if the ActualWidth and ActualHeight
        /// properties are in reality still 0 then you'll likely end up with a browser that
        /// won't render.
        /// </summary>
        /// <param name="size">size of the current control, must be greater than Size(0, 0)</param>
        /// <returns>bool to indicate if browser was created. If the browser has already been created then this will return false.</returns>
        protected virtual bool CreateOffscreenBrowser(Size size)
        {
            if (browserCreated || System.ComponentModel.DesignerProperties.GetIsInDesignMode(this) || size.IsEmpty || size.Equals(new Size(0, 0)))
            {
                return false;
            }

            var webBrowserInternal = this as IWebBrowserInternal;
            if (!webBrowserInternal.HasParent)
            {
                managedCefBrowserAdapter.CreateOffscreenBrowser(source == null ? IntPtr.Zero : source.Handle, BrowserSettings, RequestContext, Address);
            }
            browserCreated = true;

            return true;
        }
开发者ID:tuxan,项目名称:CefSharp,代码行数:25,代码来源:ChromiumWebBrowser.cs

示例5: Equals

		public static bool Equals (Size size1, Size size2)
		{
			return size1.Equals (size2);
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:4,代码来源:Size.cs

示例6: WriteAttribute

 /// <summary>
 /// Writes the attribute.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="value">The value.</param>
 /// <param name="defaultValue">The default value.</param>
 protected void WriteAttribute(string name, Size value, Size defaultValue)
 {
     if (this.settings.WriteDefaultValues || !value.Equals(defaultValue)) {
         this.writer.WriteAttributeString(name, value.Format());
     }
 }
开发者ID:modulexcite,项目名称:SilverlightWpfContrib,代码行数:12,代码来源:XamlWriter.cs


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