WPF气球笔记围绕焦点进行调整

时间:2013-03-23 18:21:57

标签: c# wpf wpf-controls

我想做的是有一个气球说明,当移动音符的茎调整。把它想象成一本漫画书。你上面和下面都有气球笔记。干变化。我希望它在移动或调整音符大小时是动态的。我不是要求一个完整的解决方案,我正在努力学习如何做到这一点。也许是对想法的提及。现在我正在制作标准的气球笔记。

<Window x:Class="WpfApplication2.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="TestNote" SizeToContent="WidthAndHeight"
    MouseLeftButtonDown="Window_MouseLeftButtonDown"
    WindowStyle="None"
    AllowsTransparency="True"
    Background="Transparent">
<Canvas Width="400" Height="400" Name="Main" >
    <Path Stroke="Gray" StrokeThickness="2" Name="testPath" Height="206.97" Stretch="Fill" Width="273.448" >
        <Path.Fill >
            <SolidColorBrush Color="Khaki"></SolidColorBrush>
        </Path.Fill>
        <Path.Data>
            <CombinedGeometry GeometryCombineMode="Union">
                <CombinedGeometry.Geometry1>
                    <RectangleGeometry Rect="0,0,100,100" RadiusX="10" RadiusY="10"/>
                </CombinedGeometry.Geometry1>
                <CombinedGeometry.Geometry2>
                    <PathGeometry >
                        <PathFigure StartPoint="50,25">
                            <ArcSegment Size="100,100" RotationAngle="45"
                                SweepDirection="CounterClockwise" Point="25,25" />
                            <LineSegment Point="0,150"/>
                        </PathFigure>
                    </PathGeometry>
                </CombinedGeometry.Geometry2>
            </CombinedGeometry>
        </Path.Data>
    </Path>
</Canvas>
</Window>

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
    }
    private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    {
        this.DragMove();
    }  
}

0 个答案:

没有答案