當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。