简体   繁体   English

使用多边形在UWP中创建聊天气泡

[英]create a Chat bubble in UWP using polygon

i am creating a chat application and would like to create the chat bubble in UWP using polygon and it look like this, 我正在创建一个聊天应用程序,并想使用多边形在UWP中创建聊天气泡,它看起来像这样, 在此处输入图片说明

How can I make it behave like I want using polygon in XAML? 如何使其表现得像我想在XAML中使用多边形?

How can I make it behave like I want using polygon in XAML? 如何使其表现得像我想在XAML中使用多边形?

This chat bubble you showed above may not be created by Polygon , since the boundary is created by connecting a line from one point to the next, with the last point connected to the first point, but your shape contains arc. 您在上方显示的此聊天气泡可能不是由Polygon创建的,因为边界是通过将一条线从一个点连接到下一个点,而最后一个点连接到第一个点来创建的,但是您的形状包含弧形。

You should be able to use Path which is a versatile Shape that you can use it to define an arbitrary geometry. 您应该能够使用路径 ,它是一种通用形状,可以使用它来定义任意几何形状。 More details please reference Draw shapes . 更多详细信息,请参考绘制形状

I created the above chat bubble by Path , and code as follows: 我通过Path创建了上面的聊天气泡,代码如下:

<Path
    Stroke="DarkGoldenRod"
    StrokeThickness="2"
    Data="M 50,50 A 20,20 90 0 1 60,40  L 230,40 A 20,20 90 0 1 240,50 V 100 L300,150 240,125 V180 A 20,20 90 0 1 230,190 H60 A 20,20 90 0 1 50,180 V50" />

You can update the path data as what you want. 您可以根据需要更新路径数据。 More details about the path data syntax please reference Move and draw commands syntax . 有关路径数据语法的更多详细信息,请参考“ 移动和绘制命令”语法

The result: 结果:

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM