WPFGroupBox控件自定义
先上效果图
直接上代码(直接在Window.Resources里面添加这段代码)
<Style TargetType="GroupBox">
<Setter Property="Margin" Value="10,5"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="GroupBox">
<Grid>
<Polyline Points="0 30,0 10,10 0,30 0" Stroke="#9918AABD" StrokeThickness="1" VerticalAlignment="Top" HorizontalAlignment="Left"/>
<Ellipse Width="4" Height="4" VerticalAlignment="Top" HorizontalAlignment="Left"
Fill="#9918AABD" Margin="24,-2,0,0"/>
<Ellipse Width="4" Height="4" VerticalAlignment="Top" HorizontalAlignment="Left"
Fill="#9918AABD" Margin="-2,24,0,0"/>
<Path Data="M0 0,3 3,30 3,33 0,68 0,73 7,78 7,78 10M8 0,25 0" Stroke="#5518AABD"
VerticalAlignment="Top" HorizontalAlignment="Right"/>
<Polyline Points="0,0 0,15 10,15" Stroke="#5518AABD" VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
<Polyline Points="10,0 0,10" Stroke="#5518AABD" VerticalAlignment="Bottom" HorizontalAlignment="Right"/>
<Polygon Points="0,7 7 7 7 0" Fill="#9918AABD" VerticalAlignment="Bottom" HorizontalAlignment="Right"/>
<Border BorderBrush="#5518AABD" BorderThickness="0,1,0,0" VerticalAlignment="Top"
Margin="30,-0.5,78,0"/>
<Border BorderBrush="#5518AABD" BorderThickness="0,0,1,0" HorizontalAlignment="Right" Margin="0,10"/>
<Border BorderBrush="#5518AABD" BorderThickness="0,1,0,0" VerticalAlignment="Bottom" Margin="10,0"/>
<Border BorderBrush="#5518AABD" BorderThickness="0,0,1,0" HorizontalAlignment="Left" Margin="-0.5,15"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>