谁是
Box
在代码中?你还可以添加一个你想要实现的形象吗?
你有没有尝试过获得你想要的东西的途径?例如,以下路径:
<Path Stroke="Black" Stretch="Fill" StrokeThickness="1" Fill="#CCCCFF">
<Path.Data>
<GeometryGroup FillRule="EvenOdd" >
<EllipseGeometry Center="40,70" RadiusX="30" RadiusY="30" />
<RectangleGeometry Rect="30,55 100 30" />
</GeometryGroup>
</Path.Data>
</Path>
给你这个剪影:
alt text http://img704.imageshack.us/img704/928/cutw.jpg
编辑:
以下是实现您的设计的一种方法:
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Page.Resources>
<SolidColorBrush x:Key="FillBrush" Color="Gray" Opacity="0.3"/>
</Page.Resources>
<Grid>
<!-- Set background image here, instead of border-->
<Border>
<Border.Background>
<LinearGradientBrush>
<GradientStop Color="#FFcacaca"/>
<GradientStop Offset="1" Color="#FF353535"/>
</LinearGradientBrush>
</Border.Background>
</Border>
<!-- Content goes here -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border
MinHeight="24"
MinWidth="100"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="{StaticResource FillBrush}"
CornerRadius="15, 0, 0, 15"
Padding="0, 0, 5, 0">
<TextBlock
HorizontalAlignment="Right"
VerticalAlignment="Center"
Foreground="White"
Text="From"/>
</Border>
<Border
MinHeight="24"
MinWidth="100"
Grid.Column="1"
HorizontalAlignment="Left"
VerticalAlignment="Top"
BorderBrush="{StaticResource FillBrush}"
BorderThickness="1"
CornerRadius="0, 15, 15, 0">
<TextBox
Margin="5, 0, 5, 0"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
Foreground="#2f3740"
Text="Verylongname, Johnathan"/>
</Border>
</Grid>
</Grid>
</Page>
主要是使用两个边框和一个画笔。对于标题字段,绘制边框的背景;对于内容字段,绘制边框的边框:)。
干杯,Anvaka。