问题标签 [pathgeometry]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
158 浏览

c# - 以编程方式扭曲 Windows Phone 中的文本

我正在尝试使用不同的 API 集(WinForms、WPF 和 Windows Phone 8)以编程方式使用 C# 绘制扭曲的文本字符串。

使用 WinForms,我设法通过 GDI+ 的System.Drawing.Drawing2D.GraphicsPath类以这种方式实现了这一点:

使用 WPF,我设法通过System.Windows.Media.Geometry从 a创建 a,通过 aSystem.Windows.Media.FormattedText将其转换为a ,然后手动创建其属性的解冻深层副本并修改每个. 它看起来像这样:PathGeometrySystem.Windows.Shapes.PathFiguresPointPolyLineSegmentPathFigurePathGeometry

我尝试将后一种解决方案移植到 Windows Phone(Windows Phone 8),但我发现它缺少FormattedText,以及s、DrawingContexts和s集合的方法(另外,它缺少and并且我没有丝毫的想法关于我将如何以及在哪里渲染修改后的,但这可以看作是一个单独的问题)。Geometry.GetFlattenedPathGeometry()CloneFigureSegmentPointRenderTargetBitmapDrawingVisualGeometry

如何将我的 WPF 代码移植到 Windows Phone 8?我可以使用哪些替代方法Geometry从文本字符串构建 a,PathGeometry从 my获取 a Geometry,以及如何获取Clone其内容?

或者是否有更好的选择可以在 Windows Phone 8 上以编程方式扭曲文本?

0 投票
1 回答
342 浏览

c# - MatrixAnimationUsingPath 在路径的环境(轮廓)上设置动画

我有一个路径数据,我从同步融合程序中复制它。我的页面中有一条包含该数据的路径,并希望在路径上(在路径线的中间)精确地为我的对象设置动画,但问题是对象在路径的轮廓(环境)上移动。

这是代码:

编辑1:我的动画走错路了。我希望我的矩形在路径线的内部和中间移动。在你的电脑上查看代码你会看到问题。我的问题是如何解决这个问题?

编辑 2:我用 DoubleAnimationUsingPath 更改动画相同的结果

编辑 3:在此处输入图像描述

0 投票
2 回答
618 浏览

wpf - 反向播放 DoubleAnimationUsingPath

我有一个包含两个动画的 WPF Storyboard(带有)。这些动画跟踪一个圆形路径,我通过添加一个. 一个动画用于控制 X 位置,而另一个动画用于控制另一个对象的 Y 位置,该对象似乎使用圆形路径在轨道上运行。RepeatBehavior=ForeverDoubleAnimationUsingPathEllipseGeometry

动画始终沿顺时针方向跟随路径,并且始终从圆圈右侧的中间开始。我需要强制动画反向播放(即沿路径逆时针播放)。理想情况下,我还希望能够控制起始位置,但这不是必需的。

动画上的AutoReverse属性做了我想要的,但显然它会在顺时针和逆时针之间交替 - 我需要动画循环,总是在逆时针方向。

我还尝试使用ScaleTransformwithScaleX = -1来翻转椭圆,希望这会有所帮助 - 但它没有。

有没有办法强制 aDoubleAnimationUsingPath沿着路径遵循特定方向?

0 投票
1 回答
1047 浏览

wpf - 以 PathGeometry 作为图标的 WPF ButtonStyle

如何将 PathGeometry 作为图标添加到按钮/radbutton 的样式中?

在我的资源中,例如:

使用 Path 我将其添加到样式中:

我怎样才能对 PathGeometry 做同样的事情?谢谢

0 投票
1 回答
92 浏览

c++ - Identifying geometric relationship between two rectangles

I have gotten into programming recently, and was looking for some help.

For the algorithm that I'm trying to implement, there are two rectangle grids, with each cell containing an object. You can think of it as a 2D array of with an x-y coordinate assigned on its origin.

Given two integer number "m" and "n", I'm going to mark n cells in one grid and (m-n) cells in the other grid, so that the marked area in one grid is the closest location for the marked area in the other grid (vise versa).

For example, let's say grid A exists between coordinate (x1, y1) and (x2, y2), and grid B exists between (a1, b1) and (a2, b2) (x1 < x2, y1 < y2, etc). If x2 < a1 and y2 < b1 (ie. grid B is on the top right side of grid A), the top right corner of grid A and bottom left corner of grid B will be marked.

I tried to design this using switch cases, but there seemed to be too many cases to be considered. If you know any better ways to do so, I would really appreciate if you can help me out.

If my question was too vague to understand, don't hesitate to point them out :)

0 投票
2 回答
589 浏览

wpf - 将 DrawingImage 转换为几何图形

我有几个在 ResourceDictionary(在 .xaml 文件中)中创建的 DrawingImages。
我还有一个“路径”,我想设置它的“数据”属性。所以,我想 1) 访问资源 2) 将其转换为 DrawingImage 3) 将其操作到可以访问绘制它的几何图形的程度。4) 将该几何图形存储在 Path.Data

0 投票
1 回答
818 浏览

wpf - 在 WPF MVVM 中预览 PathGeometry 的实际图像

在我的应用程序中有一个常见的 Icon.xaml 文件,其中包含许多具有唯一键名的 PathGeometry 图形,如下所示。

......

但我的问题是大约有 300 到 400 种不同的 PathGeometries,并且很难检查特定类型的 Image 是否存在。

例子:

如果新的 WPF 表单是程序员开发的,其中他需要使用删除图标,那么他将首先检查 Icon.xaml 文件是否已经存在,如果不存在则添加。但是这个检查需要手动完成,这很痛苦。

那么有没有最简单的方法来预览或检查特定的 iamge 是否存在。

0 投票
1 回答
175 浏览

c# - WPF中的PathGemoetry调整大小问题

我想根据用户设置的屏幕尺寸调整我的路径几何图形。
基本上想要动态更新图形或使其响应。

目前我有像

我将此路径用作:

我想根据我的屏幕尺寸调整这条路径的大小。请建议

0 投票
0 回答
650 浏览

c# - 字符串作为几何

我正在尝试在 a 中放置一个简单stringRectangle。我正在GeometryGroup为此目的使用,这是我的代码:

出于某种原因,我得到的文本加倍(见附图)。

在此处输入图像描述

我不能将Label-style 文本转换Geometry为与 一起打印Rectangle吗?

0 投票
0 回答
532 浏览

c# - 获取路径几何相对于其父级的位置

我的应用程序将路径形状添加到网格中(通过代码隐藏),类似于:

然后这些路径在一个网格内,本身在一个视图框内。当路径的起点不是 M0,0 时,如何获得路径相对于网格的位置?我尝试过使用 Canvas.GetLeft(path)/Canvas.GetTop(path) 之类的东西,但它显然不起作用。