本文整理汇总了C#中System.Drawing.RectangleF.CenterPoint方法的典型用法代码示例。如果您正苦于以下问题:C# RectangleF.CenterPoint方法的具体用法?C# RectangleF.CenterPoint怎么用?C# RectangleF.CenterPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.RectangleF
的用法示例。
在下文中一共展示了RectangleF.CenterPoint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getAboveBlocks
public static IEnumerable<Block> getAboveBlocks(BCBlockGameState gstate, RectangleF testrect)
{
var aboveblocks = from b in gstate.Blocks where b.BlockRectangle.IntersectsWith(testrect) select b;
return from bb in aboveblocks
where Math.Abs(bb.CenterPoint().Y - testrect.CenterPoint().Y) >
Math.Abs(bb.CenterPoint().X - testrect.CenterPoint().Y)
select bb;
}
示例2: GetRestingBlocks
/*
public static IEnumerable<Block> GetRestingBlocks(BCBlockGameState gstate,Block blocktest)
{
var touchingblocks = from b in gstate.Blocks where b!=blocktest && b.BlockRectangle.IntersectsWith(blocktest.BlockRectangle) select b;
return touchingblocks;
// return from b in touchingblocks where b.CenterPoint().Y > blocktest.BlockRectangle.Bottom select b;
}*/
public static IEnumerable<Block> GetRestingBlocks(BCBlockGameState gstate,RectangleF testrect)
{
var touchingblocks = from b in gstate.Blocks where b.BlockRectangle.IntersectsWith(testrect) select b;
return from bb in touchingblocks
where bb.CenterPoint().Y > testrect.CenterPoint().Y &&
Math.Abs(bb.CenterPoint().Y - testrect.CenterPoint().Y) >
Math.Abs(bb.CenterPoint().X-testrect.CenterPoint().X) select bb;
}
示例3: DrawRectangle
private static void DrawRectangle(Graphics g, String prefixtext, RectangleF drawthis, Pen RectPen, Brush RectBrush,
Brush TextBrush, Font usefont)
{
g.FillRectangle(RectBrush, drawthis);
g.DrawRectangle(RectPen, drawthis.ToRectangle());
//also paint coordinate information.
//cachestate.Blocks.Count.ToString() + " Blocks;\n"
String BlockInfotext = prefixtext +
"(" + Math.Round(drawthis.Left, 1) + "," + Math.Round(drawthis.Top, 1) + ")-(" +
"(" + Math.Round(drawthis.Right, 1) + "," + Math.Round(drawthis.Bottom, 1) + ")";
Size measurestring = TextRenderer.MeasureText(g, BlockInfotext, usefont);
Point getcenter = drawthis.CenterPoint().ToPoint();
Point DrawHere = new Point(getcenter.X - measurestring.Width / 2, getcenter.Y - measurestring.Height / 2);
g.DrawString(BlockInfotext, usefont, TextBrush, DrawHere.X, DrawHere.Y);
}