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


C# Brush.?.GetBrush方法代码示例

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


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

示例1: DrawText

 public void DrawText(string text, Rect frame, Font font, TextAlignment alignment = TextAlignment.Left, Pen pen = null, Brush brush = null)
 {
     var formattedText = new FormattedText(text, CultureInfo.InvariantCulture, System.Windows.FlowDirection.LeftToRight, font.GetTypeface(), font.Size, null);
     formattedText.SetForegroundBrush(brush?.GetBrush());
     dc.DrawText(formattedText, frame.BottomLeft.GetPoint());
 }
开发者ID:zone117x,项目名称:NGraphics,代码行数:6,代码来源:PresentationFoundationPlatform.cs

示例2: DrawPath

        public void DrawPath(IEnumerable<PathOp> ops, Pen pen = null, Brush brush = null)
        {
            StreamGeometry streamGeometry = new StreamGeometry();
            using (StreamGeometryContext geometryContext = streamGeometry.Open())
            {
                foreach (var op in ops)
                {
                    var mt = op as MoveTo;
                    if (mt != null)
                    {
                        geometryContext.BeginFigure(mt.Point.GetPoint(), false, false);
                        continue;
                    }

                    var lt = op as LineTo;
                    if (lt != null)
                    {
                        geometryContext.LineTo(lt.Point.GetPoint(), true, false);
                        continue;
                    }

                    var at = op as ArcTo;
                    if (at != null)
                    {
                        /*
                        Point c1, c2;
                        at.GetCircles(pp, out c1, out c2);
                        var circleCenter = at.LargeArc ^ !at.SweepClockwise ? c2 : c1;
                        var rotationAngle = (float)Math.Atan2(at.Point.Y - circleCenter.Y, at.Point.X - circleCenter.X);
                        geometryContext.ArcTo(at.Point.GetPoint(), at.Radius.GetSize(), rotationAngle,
                            at.LargeArc, at.SweepClockwise ? SweepDirection.Clockwise : SweepDirection.Counterclockwise,
                            true, false
                        );*/
                        throw new NotImplementedException();
                    }

                    var ct = op as CurveTo;
                    if (ct != null)
                    {
                        geometryContext.BezierTo(ct.Control1.GetPoint(), ct.Control2.GetPoint(), ct.Point.GetPoint(), true, false);
                    }

                    throw new NotSupportedException();
                }
            }
            dc.DrawGeometry(brush?.GetBrush(), pen?.GetPen(), streamGeometry);
        }
开发者ID:zone117x,项目名称:NGraphics,代码行数:47,代码来源:PresentationFoundationPlatform.cs

示例3: DrawRectangle

 public void DrawRectangle(Rect frame, Pen pen = null, Brush brush = null)
 {
     dc.DrawRectangle(brush?.GetBrush(), pen?.GetPen(), frame.GetRect());
 }
开发者ID:zone117x,项目名称:NGraphics,代码行数:4,代码来源:PresentationFoundationPlatform.cs

示例4: DrawEllipse

 public void DrawEllipse(Rect frame, Pen pen = null, Brush brush = null)
 {
     dc.DrawEllipse(brush?.GetBrush(), pen?.GetPen(), frame.Center.GetPoint(), frame.Width / 2, frame.Height / 2);
 }
开发者ID:zone117x,项目名称:NGraphics,代码行数:4,代码来源:PresentationFoundationPlatform.cs


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