首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏黄腾霄的博客

    如何将文字转换为对应的PathGeometry

    /%E5%A6%82%E4%BD%95%E5%B0%86%E6%96%87%E5%AD%97%E8%BD%AC%E6%8D%A2%E4%B8%BA%E5%AF%B9%E5%BA%94%E7%9A%84PathGeometry.html

    2.8K30发布于 2020-06-10
  • 来自专栏czwy的博客

    WPF性能优化:形状(Shape)、几何图形(Geometry)和图画(Drawing)的使用

    PathGeometry 表示更为复杂的由弧线、曲线以及直线段构成的图形,并且可以是闭合的,也可以是不闭合的。 StreamGeometry 相当于是PathGeometry的只读轻量级类。 PathGeometry 前边几种方式都是以WPF内置的几何图形(Geometry)绘制或者组合来定义形状,PathGeometry则提供更小粒度的绘制元素PathSegment,PathSegment <Path Stroke="Blue"> <Path.Data> <PathGeometry> <PathGeometry.Figures> > </PathGeometry> </Path.Data> </Path> StreamGeometry 与PathGeometry类一样,StreamGeometry可以定义包含曲线 与PathGeometry不同的是,StreamGeometry的内容不支持数据绑定、动画或修改。

    3.9K12编辑于 2024-02-01
  • 来自专栏独立观察员博客

    不可不知的WPF几何图形(Geometry)

    虽然PathGeometry也能实现基本的几何图形,但是用WPF默认提供的类,则更简单,也方便理解。 关于PathGeometry的示例代码如下所示: <Path Stroke="Black" StrokeThickness="1" > <Path.Data> <PathGeometry PathGeometry pathGeometry = new PathGeometry(); pathGeometry.Figures.Add(pathFigure); // Display the PathGeometry. 与 PathGeometry 不同,StreamGeometry 的内容不支持数据绑定、动画或修改。

    94510编辑于 2024-11-23
  • 来自专栏林德熙的博客

    win10 UWP 用Path画图

    Stroke="Black" StrokeThickness="2" Margin="10,10,10,10"> <Path.Data> <PathGeometry > </PathGeometry> </Path.Data> </Path> 其实,可以不加PathGeometry.Figures "Black" StrokeThickness="2" Margin="200,10,10,10"> <Path.Data> <PathGeometry > <PathGeometry.Figures> <PathFigure StartPoint=" > </<em>PathGeometry</em>> </Path.Data> </Path> 如果我们把第一个图,边框变大

    48110编辑于 2022-08-04
  • 来自专栏林德熙的博客

    win10 UWP 用Path画图

    Stroke="Black" StrokeThickness="2" Margin="10,10,10,10"> <Path.Data> <PathGeometry > </PathGeometry> </Path.Data> </Path> 其实,可以不加PathGeometry.Figures "Black" StrokeThickness="2" Margin="200,10,10,10"> <Path.Data> <PathGeometry > <PathGeometry.Figures> <PathFigure StartPoint=" > </<em>PathGeometry</em>> </Path.Data> </Path> 如果我们把第一个图,边框变大

    1.2K10发布于 2018-09-18
  • 来自专栏独立观察员博客

    不可不知的WPF形状(Shape)

    常见的Geometry类型有LineGeometry,RectangleGeometry,EllipseGeometry等简单的图形,还可以用PathGeometry创建复杂的图形。 PathGeometry 对象由一个或多个 PathFigure 对象组成;每个 PathFigure 代表不同的“图形”或形状。 <Path Stroke="Black" StrokeThickness="1"> <Path.Data> <PathGeometry> <PathGeometry.Figures > </PathGeometry> </Path.Data> </Path> 上述代码中,Figures作为PathGeometry的默认属性,Segments作为PathFigure的默认属性 ,可以省略,简化后的代码如下所示: <Path Stroke="Black" StrokeThickness="1"> <Path.Data> <PathGeometry>

    94910编辑于 2024-11-23
  • 来自专栏林德熙的博客

    win10 uwp 分治法

    Windows.UI.Xaml.Shapes.Path path_figure = new Path() { Data = new PathGeometry Stroke = new SolidColorBrush(Colors.Gray) }; 如果觉得这样太快了,我们可以弄个差 PathGeometry path_figure = new PathGeometry(); for (int i = 0; i < point.Count; i++) {

    40450编辑于 2022-08-07
  • 来自专栏菩提树下的杨过

    silverlight:贝塞尔曲线

    <Path Stroke="Red" StrokeThickness="1" x:Name="p" > <Path.Data> <PathGeometry > <PathGeometry.Figures> <PathFigure> </PathFigure.Segments> </PathFigure> </PathGeometry.Figures > </PathGeometry> </Path.Data> </Path> </Canvas> </UserControl tbRightPoint.SetValue(Canvas.TopProperty, _rightPoint.Y + 10); PathFigure figure = (p.Data as PathGeometry

    935100发布于 2018-01-24
  • 来自专栏林德熙的博客

    dotnet OpenXML 转换 PathFillModeValues 为颜色特效

    绘制之前需要拿到底色绘制用的 PathGeometry 对象,如下面代码 // 创建底色几何 var pathGeometry = BuildShapePathGeometry (shapePathList); private PathGeometry BuildShapePathGeometry(ShapePath[] shapePathList) { PathGeometry? GetPathGeometry(ShapePath shapePath) { var pathGeometry = new PathGeometry(); = pathFigureCollection; return pathGeometry; } 获取各段的 Geometry 的画刷,通过 GetShapeFillBrush

    1.1K20发布于 2021-11-08
  • 来自专栏WPF自定义控件与特效

    深度剖析一个弧形进度条的实现

    StrokeThickness="8" Width="200" Height="200"> <Path.Data> <PathGeometry RotateTransform Angle="45"/> </TransformGroup> </Path.RenderTransform> <Path.Data> <PathGeometry SweepDirection="Clockwise" x:Name="pathArc"/> </PathFigure> </PathGeometry > </Path.RenderTransform> <Path.Data> <PathGeometry SweepDirection="Clockwise" x:Name="pathArc"/> </PathFigure> </PathGeometry

    1K10编辑于 2024-12-13
  • 来自专栏历史专栏

    【愚公系列】2023年11月 WPF控件专题 Path控件详解

    <GeometryGroup> <LineGeometry StartPoint="50,50" EndPoint="200,50"/> <PathGeometry > <PathGeometry.Figures> <PathFigureCollection> </PathFigure> </PathFigureCollection> </PathGeometry.Figures > </PathGeometry> </GeometryGroup> </Path.Data> </Path></Canvas>结果如下图所示

    2.2K11编辑于 2023-11-11
  • 来自专栏Kiba518

    WPF滑块控件(Slider)的自定义样式

    " StrokeThickness="1" UseLayoutRounding="True" VerticalAlignment="Center"> <Path.Data> <PathGeometry > <PathGeometry.Figures> <PathFigure StartPoint="0,0" IsClosed="True"> > </PathGeometry> </Path.Data> </Path> 效果图如下: ? " StrokeThickness="1" UseLayoutRounding="True" VerticalAlignment="Center"> <Path.Data> <PathGeometry > </PathGeometry> </Path.Data> </Path> 效果图如下: ?

    4.5K30发布于 2019-08-02
  • 来自专栏林德熙的博客

    控件

    <Path Stroke="Black" StrokeThickness="10"> <Path.Data> <PathGeometry > <PathGeometry.Figures> <PathFigure StartPoint=" > </<em>PathGeometry</em>> </Path.Data> </Path> ? StrokeThickness="10"> <Path.Data> <PathGeometry > <PathGeometry.Figures>

    6K10发布于 2018-09-19
  • 来自专栏JusterZhu

    WPF实现新手提示功能

    #000000", BulgeStyle bulgeStyle = BulgeStyle.Dotted) { var path = new Path(); var pathGeometry = new PathGeometry(); var pathFigure = new PathFigure(); pathFigure.StartPoint = startPoint LineSegment() { Point = relativePoint }); pathFigure.Segments = segmentCollection; pathGeometry.Figures = new PathFigureCollection() { pathFigure }; path.Data = pathGeometry; path.Stroke =

    76430编辑于 2022-12-07
  • 来自专栏林德熙的博客

    WPF 已知问题 包含 NaN 的 Geometry 几何可能导致渲染层抛出 UCEERR_RENDERTHREADFAILURE 异常

    double y) { pf.Segments.Add(new LineSegment(new Point(x, y), true)); } public static PathGeometry GetRoundedRect(Rect rect, double cr) { PathGeometry pg = new PathGeometry(); PathFigure resultGeometry = new PathGeometry(); } 也就是说在 PathGeometry 底层已经判断了此情况,如果有 NaN 的情况就替换为空的 PathGeometry System.Windows.Media.PathGeometry.InternalCombine(System.Windows.Media.Geometry geometry1 = {System.Windows.Media.PathGeometry System.Windows.Media.Geometry.Combine(System.Windows.Media.Geometry geometry1 = {System.Windows.Media.PathGeometry

    1.2K10编辑于 2023-12-13
  • 来自专栏DotNet NB && CloudNative

    更复杂的代码,为何跑得快了10倍?一次Draw Call优化引发的思考

    在和朋友讨论后,我决定尝试使用 ID2D1PathGeometry 来重构绘制逻辑。 ID2D1PathGeometry 允许我们先在内存中构建一个完整的几何路径,然后一次性地将其提交给 GPU 进行绘制。 从代码表面上看,使用 ID2D1PathGeometry 的版本涉及到了更多的 API 调用:CreatePathGeometry、Open、BeginFigure、AddLine、EndFigure、 我曾经误以为,DrawLine 是一个非常底层的、直接的绘制指令,而 ID2D1PathGeometry 是一个更上层、更抽象的封装,性能可能会更差。 而使用 ID2D1PathGeometry 的方案,虽然在 CPU 端看起来代码更复杂,但所有的路径构建工作(AddLine 等)都「只在内存中进行,不涉及与 GPU 的直接交互」。

    18910编辑于 2025-09-02
  • 来自专栏独立观察员博客

    不可不知的WPF动画(Animation)

    路径动画 路径动画是一种使用PathGeometry作为输入的动画时间线(AnimationTimeline),可以定义一个几何路径并使用它来设置路径动画的PathGeometry属性,而不是使用From 常见的路径动画如下表所示: 路径动画说明: MatrixAnimationUsingPath 从其 PathGeometry 生成 Matrix 值。 PointAnimationUsingPath 从其 PathGeometry 的 x 和 y 坐标生成 Point 值。 DoubleAnimationUsingPath 从其 PathGeometry 生成 Double 值。 > <PathGeometry Figures="M 10,100 C 35,0 135,0 160,100 180,190 285,200

    96110编辑于 2024-11-23
  • 来自专栏独立观察员博客

    WPF 实现扇形统计图

    PathFigure>() { pathFigure, }; var pathGeometry = new PathGeometry(pathFigures); var path = new Path() { Fill = item.PieColor, Data = pathGeometry, DataContext = piebase }; _canvas.Children.Add(path); pathDataContext.PolylineEndPoint = point3; return line3; } PathGeometry pathGeometry = geo.GetFlattenedPathGeometry(); return pathGeometry; } } }

    1.8K10编辑于 2022-12-06
  • 来自专栏dino.c的专栏

    [UWP]实用的Shape指南

    PathGeometry: 表示一个可能由弧、曲线、椭圆、直线和矩形组成的基于矢量的复杂形状。 RectangleGeometry: 描述二维矩形这一几何图形。 5.2 PathGeometry 在所有Geometry中PathGeometry是功能最强大的,唯一的缺点是太多复杂。 > <PathGeometry.Figures> <PathFigureCollection> </PathFigure> </PathFigureCollection> </PathGeometry.Figures > </PathGeometry> </GeometryGroup> </Path.Data> </Path> ?

    1.6K30发布于 2019-01-18
  • 来自专栏林德熙的博客

    win10 uwp 分治法

    Windows.UI.Xaml.Shapes.Path path_figure = new Path() { Data = new PathGeometry Stroke = new SolidColorBrush(Colors.Gray) }; 如果觉得这样太快了,我们可以弄个差 PathGeometry path_figure = new PathGeometry(); for (int i = 0; i < point.Count; i++) {

    57710发布于 2018-09-18
领券