本文整理汇总了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()));
}
示例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)");
}
示例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;
}
示例4: CreateOffscreenBrowser
/// <summary>
/// Create the underlying Browser instance, can be overriden to defer control creation
/// The browser will only be created when size > 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;
}
示例5: Equals
public static bool Equals (Size size1, Size size2)
{
return size1.Equals (size2);
}
示例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());
}
}