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


C# Rect.ToRectangle方法代码示例

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


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

示例1: Begin

        public void Begin(Rect clippingRect)
        {
            if (this.currentClippingRect != clippingRect)
            {
                this.currentClippingRect = clippingRect;

                if (this.isBatchOpen)
                {
                    this.End();
                }

                if (clippingRect.IsEmpty)
                {
                    this.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
                }
                else
                {
                    this.spriteBatch.GraphicsDevice.ScissorRectangle = clippingRect.ToRectangle();

                    this.spriteBatch.Begin(
                        SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, ScissorTestingRasterizerState);
                }

                this.isBatchOpen = true;
            }
        }
开发者ID:redbadger,项目名称:XPF,代码行数:26,代码来源:SpriteBatchAdapter.cs

示例2: CaptureArea

        public virtual Bitmap CaptureArea(Rect rect)
        {
            var rectangle = rect.ToRectangle();
            var width = rectangle.Right - rectangle.Left;
            var height = rectangle.Bottom - rectangle.Top;
            var bmp = new Bitmap(width, height, PixelFormat.Format32bppArgb);
            var graphics = Graphics.FromImage(bmp);

            graphics.CopyFromScreen(rectangle.Left, rectangle.Top, 0, 0, new Size(width, height), CopyPixelOperation.SourceCopy);

            return bmp;
        }
开发者ID:EDOlsson,项目名称:White,代码行数:12,代码来源:ScreenCapture.cs

示例3: CopyFromScreenSnapshot

        internal BitmapSource CopyFromScreenSnapshot(Rect region)
        {
            var sourceRect = region.ToRectangle();
            var destRect = new Rectangle(0, 0, sourceRect.Width, sourceRect.Height);

            if (screenSnapshot != null)
            {
                var bitmap = new Bitmap(sourceRect.Width, sourceRect.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
                using (Graphics g = Graphics.FromImage(bitmap))
                {
                    g.DrawImage(screenSnapshot, destRect, sourceRect, GraphicsUnit.Pixel);
                }

                return bitmap.ToBitmapSource();
            }

            return null;
        }
开发者ID:wangws556,项目名称:duoduo-chat,代码行数:18,代码来源:MaskWindow.cs

示例4: DrawFilledRect

 public void DrawFilledRect(Rect rect, Color colorTint)
 {
     var patt =LineStroke.Solid.PatternProvider;
     Batch.Draw(patt, rect.ToRectangle(), patt.Bounds, colorTint);
 }
开发者ID:Neio,项目名称:MonoGame2D,代码行数:5,代码来源:Canvas2D.cs

示例5: SurfaceImageSourceCanvas

        public SurfaceImageSourceCanvas(SurfaceImageSource surfaceImageSource, Rect updateRect, Direct2DFactories factories = null)
            : base(factories)
        {
            sisn = ComObject.As<DXGI.ISurfaceImageSourceNative> (surfaceImageSource);
            SharpDX.Point offset;
            var surface = sisn.BeginDraw (updateRect.ToRectangle (), out offset);

            var dpi = 96.0;
            var properties = new D2D1.RenderTargetProperties (D2D1.RenderTargetType.Default, new D2D1.PixelFormat (DXGI.Format.Unknown, D2D1.AlphaMode.Unknown), (float)(dpi), (float)(dpi), D2D1.RenderTargetUsage.None, D2D1.FeatureLevel.Level_DEFAULT);
            Initialize (new D2D1.RenderTarget (this.factories.D2DFactory, surface, properties));
        }
开发者ID:mvdhorstclb,项目名称:NGraphics,代码行数:11,代码来源:Direct2DCanvas.cs


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