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


C# Rect.ToDirect2D方法代码示例

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


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

示例1: FillRectangle

 /// <summary>
 /// Draws a filled rectangle.
 /// </summary>
 /// <param name="brush">The brush.</param>
 /// <param name="rect">The rectangle bounds.</param>
 /// <param name="cornerRadius">The corner radius.</param>
 public void FillRectangle(Perspex.Media.Brush brush, Rect rect, float cornerRadius)
 {
     using (var b = CreateBrush(brush, rect.Size))
     {
         if (b.PlatformBrush != null)
         {
             if (cornerRadius == 0)
             {
                 _renderTarget.FillRectangle(rect.ToDirect2D(), b.PlatformBrush);
             }
             else
             {
                 _renderTarget.FillRoundedRectangle(
                     new RoundedRectangle
                     {
                         Rect = new RectangleF(
                                 (float)rect.X,
                                 (float)rect.Y,
                                 (float)rect.Width,
                                 (float)rect.Height),
                         RadiusX = cornerRadius,
                         RadiusY = cornerRadius
                     },
                     b.PlatformBrush);
             }
         }
     }
 }
开发者ID:tshcherban,项目名称:Perspex,代码行数:34,代码来源:DrawingContext.cs

示例2: DrawRectange

 /// <summary>
 /// Draws the outline of a rectangle.
 /// </summary>
 /// <param name="pen">The pen.</param>
 /// <param name="rect">The rectangle bounds.</param>
 /// <param name="cornerRadius">The corner radius.</param>
 public void DrawRectange(Pen pen, Rect rect, float cornerRadius)
 {
     using (var brush = pen.Brush.ToDirect2D(this.renderTarget))
     using (var d2dStroke = pen.ToDirect2DStrokeStyle(this.renderTarget))
     {
         this.renderTarget.DrawRoundedRectangle(
             new RoundedRectangle { Rect = rect.ToDirect2D(), RadiusX = cornerRadius, RadiusY = cornerRadius },
             brush,
             (float)pen.Thickness,
             d2dStroke);
     }
 }
开发者ID:Scellow,项目名称:Perspex,代码行数:18,代码来源:DrawingContext.cs

示例3: DrawRectangle

 /// <summary>
 /// Draws the outline of a rectangle.
 /// </summary>
 /// <param name="pen">The pen.</param>
 /// <param name="rect">The rectangle bounds.</param>
 /// <param name="cornerRadius">The corner radius.</param>
 public void DrawRectangle(Pen pen, Rect rect, float cornerRadius)
 {
     using (var brush = CreateBrush(pen.Brush, rect.Size))
     using (var d2dStroke = pen.ToDirect2DStrokeStyle(_renderTarget))
     {
         if (brush.PlatformBrush != null)
         {
             if (cornerRadius == 0)
             {
                 _renderTarget.DrawRectangle(
                     rect.ToDirect2D(),
                     brush.PlatformBrush,
                     (float)pen.Thickness,
                     d2dStroke);
             }
             else
             {
                 _renderTarget.DrawRoundedRectangle(
                     new RoundedRectangle { Rect = rect.ToDirect2D(), RadiusX = cornerRadius, RadiusY = cornerRadius },
                     brush.PlatformBrush,
                     (float)pen.Thickness,
                     d2dStroke);
             }
         }
     }
 }
开发者ID:tshcherban,项目名称:Perspex,代码行数:32,代码来源:DrawingContext.cs


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