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


C# Rect.Inflate方法代码示例

本文整理汇总了C#中Rect.Inflate方法的典型用法代码示例。如果您正苦于以下问题:C# Rect.Inflate方法的具体用法?C# Rect.Inflate怎么用?C# Rect.Inflate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Rect的用法示例。


在下文中一共展示了Rect.Inflate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RectInflate

		public void RectInflate ()
		{
			var r = new Rect (new Size (10, 20));
			r.Inflate (4, 6);
			Assert.AreEqual (-4, r.X);
			Assert.AreEqual (-6, r.Y);
			Assert.AreEqual (18, r.Width);
			Assert.AreEqual (32, r.Height);
		}
开发者ID:michaelstonis,项目名称:NGraphics,代码行数:9,代码来源:PrimitivesTest.cs

示例2: InflateTest1

        public void InflateTest1()
        {
            var rect = new Rect (0, 0, 100, 100);
            rect.Inflate (10, 20);

            Assert.AreEqual (-10, rect.X);
            Assert.AreEqual (-20, rect.Y);
            Assert.AreEqual (120, rect.Width);
            Assert.AreEqual (140, rect.Height);
        }
开发者ID:magerate,项目名称:Geometries,代码行数:10,代码来源:RectTests.cs

示例3: InflateTest2

        public void InflateTest2()
        {
            Action test = () => {
                double x = TestHelper.NextDouble(double.MinValue + 100);
                double y = TestHelper.NextDouble(double.MinValue + 100);
                double width = TestHelper.NextDouble(double.MaxValue - 100);
                double height = TestHelper.NextDouble(double.MaxValue - 100);

                var rect = new Rect(x,y,width,height);

                double fWidth = TestHelper.NextDouble(100);
                double fHeight = TestHelper.NextDouble(100);

                rect.Inflate (fWidth, fHeight);

                Assert.AreEqual (x, rect.X + fWidth);
                Assert.AreEqual (y, rect.Y + fHeight);
                Assert.AreEqual (width, rect.Width - 2 * fWidth);
                Assert.AreEqual (height, rect.Height - 2 * fHeight);

                Assert.True(rect.Contains(new Rect(x,y,width,height)));
            };
            test.RunBatch (batchCount);
        }
开发者ID:magerate,项目名称:Geometries,代码行数:24,代码来源:RectTests.cs

示例4: _IsSpatiallyCombinable

        private bool _IsSpatiallyCombinable(Rect rect1, Rect rect2, double inflateH, double inflateV)
        { 
            //Do these rects intersect? If so, we can combine
            if (rect1.IntersectsWith(rect2)) 
            { 
                return true;
            } 

            //Try inflating
            rect1.Inflate(inflateH, inflateV);
            if (rect1.IntersectsWith(rect2)) 
            {
                return true; 
            } 
            return false;
        } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:16,代码来源:FixedSOMPageConstructor.cs

示例5: OnRender

        protected internal override void OnRender(DrawingContext drawingContext)
        {
            Rect brushRect = new Rect(new Size(this.ActualWidth, this.ActualHeight));
            Rect penRect = brushRect;
            Pen pen = null;

            if (this.BorderBrush != null && !this.BorderThickness.IsEmpty)
            {
                pen = new Pen(this.BorderBrush, this.BorderThickness.Left);

                double penOffset = -(pen.Thickness / 2);
                brushRect.Inflate(-pen.Thickness, -pen.Thickness);
                penRect.Inflate(penOffset, penOffset);
            }

            if (this.CornerRadius.TopLeft > 0 || this.CornerRadius.BottomLeft > 0)
            {
                drawingContext.DrawRoundedRectangle(
                    this.Background,
                    pen,
                    brushRect,
                    this.CornerRadius.TopLeft,
                    this.CornerRadius.BottomLeft);
            }
            else
            {
                if (this.Background != null)
                {
                    drawingContext.DrawRectangle(this.Background, null, brushRect);
                }

                if (pen != null)
                {
                    drawingContext.DrawRectangle(null, pen, penRect);
                }
            }
        }
开发者ID:modulexcite,项目名称:Avalonia,代码行数:37,代码来源:Border.cs


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