本文整理汇总了C#中System.Drawing.RectangleF.RectOffset方法的典型用法代码示例。如果您正苦于以下问题:C# RectangleF.RectOffset方法的具体用法?C# RectangleF.RectOffset怎么用?C# RectangleF.RectOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.RectangleF
的用法示例。
在下文中一共展示了RectangleF.RectOffset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Offset
public static RectangleF Offset( RectangleF rect, PointF pos)
{
return rect.RectOffset(pos);
}
示例2: DetermineGeometry
//.........这里部分代码省略.........
}
}
//end switch statement
// var bgFrame = bgRect.RectOffset(offset.X, offset.Y);
// var bgFrame = RectangleFExtensions.Offset(bgRect, offset.X, offset.Y);
var bgFrame = bgRect;
bgFrame.X += offset.X;
bgFrame.Y += offset.Y;
var minMarginLeft = bgFrame.GetMinX() - displayArea.GetMinX();
var minMarginRight = displayArea.GetMaxX() - bgFrame.GetMaxY();
var minMarginTop = bgFrame.GetMinY() - displayArea.GetMinY();
var minMarginBottom = displayArea.GetMaxY() - bgFrame.GetMaxY();
if(minMarginLeft < 0) {
// Popover is too wide and clipped on the left; decrease width
// and move it to the right
offset.X -= minMarginLeft;
bgRect.Size.Width += minMarginLeft;
minMarginLeft = 0;
if(direction == UIPopoverArrowDirection.Right) {
arrowRect.X = bgRect.GetMaxX() - Properties.RightBgMargin;
}
}
if(minMarginRight < 0) {
// Popover is too wide and clipped on the right; decrease width.
bgRect.Size.Width += minMarginRight;
minMarginRight = 0;
if(direction == UIPopoverArrowDirection.Left) {
arrowRect.X = bgRect.GetMinX() - leftArrowImage.Size.Width + Properties.LeftBgMargin;
}
}
if(minMarginTop < 0) {
// Popover is too high and clipped at the top; decrease height and move it down
offset.Y -= minMarginTop;
bgRect.Size.Height += minMarginTop;
minMarginTop = 0;
if(direction == UIPopoverArrowDirection.Down) {
arrowRect.Y = bgRect.GetMaxY() - Properties.BottomBgMargin;
}
}
if(minMarginBottom < 0) {
// Popover is too high and clipped at the bottom; decrease height.
bgRect.Size.Height += minMarginBottom;
minMarginBottom = 0;
if(direction == UIPopoverArrowDirection.Up) {
arrowRect.Y = bgRect.GetMinY() - upArrowImage.Size.Height + Properties.TopBgMargin;
}
}
bgFrame = bgRect.RectOffset(offset.X, offset.Y);
var minMargin = Math.Min(minMarginLeft, minMarginRight);
minMargin = Math.Min(minMargin, minMarginTop);
minMargin = Math.Min(minMargin, minMarginBottom);
// Calculate intersection and surface
var intersection = RectangleF.Intersect(displayArea, bgFrame);
var surface = intersection.Size.Width * intersection.Size.Height;
if(surface >= biggestSurface && minMargin >= currentMinMargin) {
biggestSurface = surface;
_Offset = offset;
_ArrowRect = arrowRect;
_BackgroundRect = bgRect;
PopoverArrowDirection = direction;
currentMinMargin = minMargin;
}
} // end if
} //end foreach
switch(PopoverArrowDirection) {
case UIPopoverArrowDirection.Up:
_ArrowImage = upArrowImage;
break;
case UIPopoverArrowDirection.Down:
_ArrowImage = downArrowImage;
break;
case UIPopoverArrowDirection.Left:
_ArrowImage = leftArrowImage;
break;
case UIPopoverArrowDirection.Right:
_ArrowImage = rightArrowImage;
break;
}
}