本文整理汇总了C#中System.Windows.Rect.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Rect.Equals方法的具体用法?C# Rect.Equals怎么用?C# Rect.Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Rect
的用法示例。
在下文中一共展示了Rect.Equals方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoesntContain
protected virtual bool DoesntContain(Rect rect, double otherStart, double otherEnd)
{
if (rect.Equals(Rect.Empty)) return true;
double center = (otherStart + otherEnd)/2;
if (center.IsInvalid()) return true;
return center < start || center > end;
}
示例2: AnimateActiveAreaRectTo
internal void AnimateActiveAreaRectTo(Rect newRect)
{
if (newRect.Equals(currentAnimateActiveAreaRectToTarget))
return;
activeAreaGeometry.BeginAnimation(
RectangleGeometry.RectProperty,
new RectAnimation(newRect, new Duration(new TimeSpan(0,0,0,0,100))),
HandoffBehavior.SnapshotAndReplace);
currentAnimateActiveAreaRectToTarget = newRect;
}
示例3: Equals
public void Equals ()
{
Rect r1 = new Rect (1, 2, 3, 4);
Rect r2 = r1;
Assert.IsTrue (r1.Equals (r1));
r2.X = 0;
Assert.IsFalse (r1.Equals (r2));
r2.X = r1.X;
r2.Y = 0;
Assert.IsFalse (r1.Equals (r2));
r2.Y = r1.Y;
r2.Width = 0;
Assert.IsFalse (r1.Equals (r2));
r2.Width = r1.Width;
r2.Height = 0;
Assert.IsFalse (r1.Equals (r2));
r2.Height = r1.Height;
Assert.IsFalse (r1.Equals (new object ()));
r1 = Rect.Empty;
r2 = Rect.Empty;
Assert.AreEqual (true, r1.Equals (r2));
Assert.AreEqual (true, r2.Equals (r1));
}
示例4: Equals
public static bool Equals(Rect rect1, Rect rect2)
{
return rect1.Equals (rect2);
}
示例5: ShowPopup
private void ShowPopup(PopupData popupData, UIElement element, Rect startRect, Rect endRect, double startOpacity, double endOpacity, double animationDuration, Action onClosed, IEnumerable<AnimationInfo> animations = null)
{
if (popupData.Element != null)
ClosePopup(popupData, popupData.Element, true);
var sizedElement = new SizedElement(element, new Size(startRect.Width, startRect.Height)) { Opacity = startOpacity };
Popup popup = popupData.Popup;
popup.Child = sizedElement;
popup.HorizontalOffset = startRect.X;
popup.VerticalOffset = startRect.Y;
popup.Width = startRect.Width;
popup.Height = startRect.Height;
popupData.Element = element;
popupData.OnPopupClosed = onClosed;
popup.IsOpen = true;
popupData.InitialBackgroundState = myCurrentBackgroundState;
if (!endRect.Equals(startRect))
{
var xAnimation = new AnimationInfo(popup, new PropertyPath(Popup.HorizontalOffsetProperty), startRect.X, endRect.X);
var yAnimation = new AnimationInfo(popup, new PropertyPath(Popup.VerticalOffsetProperty), startRect.Y, endRect.Y);
var widthAnimation = new AnimationInfo(sizedElement, new PropertyPath(SizedElement.WidthProperty), startRect.Width, endRect.Width);
var heightAnimation = new AnimationInfo(sizedElement, new PropertyPath(SizedElement.HeightProperty), startRect.Height, endRect.Height);
var additionalAnimations = new[] {xAnimation, yAnimation, widthAnimation, heightAnimation};
animations = animations != null ? animations.Concat(additionalAnimations) : additionalAnimations;
}
popupData.AnimationsOnClose = animations != null ? (ICollection<AnimationInfo>)animations.Select(info => info.Reverse()).ToList() : new AnimationInfo[0];
AnimatePopup(sizedElement, animationDuration, endOpacity, Math.Min(myCurrentBackgroundState.Opacity, 0.7), 5, animations);
}
示例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, Rect value, Rect defaultValue)
{
if (this.settings.WriteDefaultValues || !value.Equals(defaultValue)) {
this.writer.WriteAttributeString(name, value.Format());
}
}
示例7: EqualsNaN
public void EqualsNaN ()
{
Rect r = new Rect (Double.NaN, Double.NaN, Double.NaN, Double.NaN);
Assert.IsFalse (r.Equals (r), "Equals(Rect)");
Assert.IsFalse (r.Equals ((object)r), "Equals(object)");
}