我已经创建了一个UserControl,它是通过叠加2个圆圈的小圆圈是空白的,第二个是最小的被着色的。如何在WPF中创建一个带圆圈的圆圈?
在我的WPF应用程序中,我想放几个戒指,但小圆圈确实会隐藏其他戒指。我希望通过它看到并捕获鼠标事件,以便在其他环之后响铃,否则它不是真正的响铃。可能吗 ?
我试着OpacityMask的小椭圆为指向的答案http://social.msdn.microsoft.com/forums/en-US/wpf/thread/551201d1-c5b3-4e17-ae63-625cfbb8bcc4但仍无法看到背后孔环:
<UserControl x:Class="MyUserControls.MyRing"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="150" d:DesignWidth="150" SizeChanged="UserControl_SizeChanged">
<Grid Height="150" Name="Grid" Width="150" MouseMove="ellipse1_MouseMove">
<Ellipse Fill="Red" Height="150" Width="150" HorizontalAlignment="Left" Margin="0,0,0,0" Name="ellipse1" Stroke="Black" VerticalAlignment="Top" >
<Ellipse.OpacityMask>
<RadialGradientBrush>
<GradientStop Color="#FFB94444" Offset="0.496"/>
<GradientStop Color="#00FFFFFF" Offset="0.491"/>
</RadialGradientBrush>
</Ellipse.OpacityMask>
</Ellipse>
<Ellipse Fill="White" Height="100" Width="100" Margin="25,25,25,0" Name="ellipse2" Stroke="Black" VerticalAlignment="Top" />
</Grid>
</UserControl>
我试过这个问题是因为我可以看到背后的大圆圈,所以它不再是一个圆环:)我想要第二个圆来对它应用一些渐变,所以大边框无法做到这一点,就我所能预见的那样。 – user310291 2011-01-24 19:34:11
很高兴谢谢:) – user310291 2011-01-24 20:47:33