积极答复者
checkbox如何设置它的样式,不用系统的。

问题
-
利用模版改变系统checkbox的样式,做成如下形式的
模版中有些属性不太明白怎么处理
<Path x:Name="CheckGlyph" Data="F1 M 0,58 L 2,56 L 6,60 L 13,51 L 15,53 L 6,64 z" FlowDirection="LeftToRight" Height="50" Margin="0,0,0,0" Opacity="0" Stretch="Fill" VerticalAlignment="Top" UseLayoutRounding="False" Width="50"> <Path.Fill> <ImageBrush ImageSource="Assets/checked.png"/> </Path.Fill> </Path>
现在设置出来选中的状态,对号很小不规则。如图所示
是因为Data没处理好吗?这个Data怎么设置?
<Rectangle x:Name="IndeterminateGlyph" Fill="{StaticResource CheckBoxForegroundThemeBrush}" Height="9" Margin="14,9,14,0" Opacity="0" VerticalAlignment="Top"/> <Rectangle x:Name="FocusVisualWhite" Height="40" Opacity="0" StrokeDashOffset="0.5" StrokeEndLineCap="Square" Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}" StrokeDashArray="1,1" VerticalAlignment="Top" Margin="0,0,3,0"/> <Rectangle x:Name="FocusVisualBlack" Height="40" Opacity="0" StrokeDashOffset="1.5" StrokeEndLineCap="Square" Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}" StrokeDashArray="1,1" VerticalAlignment="Center" Width="40" HorizontalAlignment="Center" Margin="-3,1,3,1" Fill="{x:Null}"/>
这几个属性有关吗?
答案
-
Hi,
上面的Data实际上是路径信息,系统用路径画出了一个对号。
F1指Nonzero填充规则。M是移动表示新的起始点,L是线段,之后是终点坐标,z代表闭合路径。
Nonezero规则是这样,从外部穿过边界进入内部,如果不是0则认为在物体内部,穿过一条边界会加1或减1,这个根据线段的方向考虑,换句话说Nonezero考虑线段方向一个方向的加1另一个方向减1。因此,这个很容易出现一些令人费解的填充效果。不过如果图形简单比如上面这个,效果是一样的。
http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.shapes.path.data.aspx
上面说的不太全。
这个是WPF里的path写的比较齐全:
http://msdn.microsoft.com/en-us/library/ms752293.aspx
Aaron
MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help.- 已标记为答案 Aaron XueModerator 2013年1月8日 4:21
全部回复
-
Hi,
上面的Data实际上是路径信息,系统用路径画出了一个对号。
F1指Nonzero填充规则。M是移动表示新的起始点,L是线段,之后是终点坐标,z代表闭合路径。
Nonezero规则是这样,从外部穿过边界进入内部,如果不是0则认为在物体内部,穿过一条边界会加1或减1,这个根据线段的方向考虑,换句话说Nonezero考虑线段方向一个方向的加1另一个方向减1。因此,这个很容易出现一些令人费解的填充效果。不过如果图形简单比如上面这个,效果是一样的。
http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.shapes.path.data.aspx
上面说的不太全。
这个是WPF里的path写的比较齐全:
http://msdn.microsoft.com/en-us/library/ms752293.aspx
Aaron
MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help.- 已标记为答案 Aaron XueModerator 2013年1月8日 4:21