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


C# RectangleF.CenterPoint方法代码示例

本文整理汇总了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;
 }
开发者ID:BCProgramming,项目名称:BASeBlock,代码行数:8,代码来源:FallingBlockObject.cs

示例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;
        }
开发者ID:BCProgramming,项目名称:BASeBlock,代码行数:17,代码来源:FallingBlockObject.cs

示例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);
        }
开发者ID:BCProgramming,项目名称:BASeBlock,代码行数:19,代码来源:DebugHelper.cs


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