0
我試圖在兩端繪製一個帶有半圓的矩形。我也試圖分割左半部分與右半部分不同顏色的矩形。我已經設法使用堆疊面板和CombinedGeometry來做到這一點,如下例所示。但是,下面的代碼在堆棧面板中的每個控件之間繪製一條線。我已經嘗試了幾件事去除它或繪製它。有誰知道如何刪除這條線,我懷疑是邊界,還是有更好的方法?我試圖添加只是控制,而不是在邊界內的控制,但它沒有任何區別。 感謝StackPanel在每個子控件之間繪製工件
<UserControl x:Class="xxx"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel Orientation="Horizontal" DataContext="{Binding ElementName=InfoControl, Path=.}">
<Border Background="White" BorderThickness="0">
<Path Fill="LightBlue">
<Path.Data>
<CombinedGeometry GeometryCombineMode="Intersect">
<CombinedGeometry.Geometry1>
<EllipseGeometry Center="15,15" RadiusX="15" RadiusY="15"/>
</CombinedGeometry.Geometry1>
<CombinedGeometry.Geometry2>
<RectangleGeometry Rect="0 0 15 30"/>
</CombinedGeometry.Geometry2>
</CombinedGeometry>
</Path.Data>
</Path>
</Border>
<Border Background="LightBlue" BorderThickness="0">
<TextBlock x:Name="nameTextBlock" Foreground="SteelBlue" VerticalAlignment="Center" FontSize="16" Margin="0 0 5 0">-</TextBlock>
</Border>
<Border Background="CornflowerBlue" BorderThickness="0">
<TextBlock x:Name="dataTextBlock" Foreground="White" VerticalAlignment="Center" FontSize="16" Margin="5 0 0 0">-</TextBlock>
</Border>
<Border Background="White" BorderThickness="0">
<Path Fill="CornflowerBlue">
<Path.Data>
<CombinedGeometry GeometryCombineMode="Intersect">
<CombinedGeometry.Geometry1>
<EllipseGeometry Center="0,15" RadiusX="15" RadiusY="15"/>
</CombinedGeometry.Geometry1>
<CombinedGeometry.Geometry2>
<RectangleGeometry Rect="0 0 30 30"/>
</CombinedGeometry.Geometry2>
</CombinedGeometry>
</Path.Data>
</Path>
</Border>
</StackPanel>
謝謝你,工作:-) – 2009-10-17 18:09:15