0
我想在WPF中創建將應用於矩形的自定義畫筆。 Fill = myCustomBrush。 theCustomBrush包含一個PNG圖像(ImageBrush),並在背景中包含一種顏色(SolidColorBrush)。 我想用這兩個標準畫筆創建一個custombrush。使用Png(透明)圖像和背景顏色創建自定義畫筆
感謝您的幫助。
我想在WPF中創建將應用於矩形的自定義畫筆。 Fill = myCustomBrush。 theCustomBrush包含一個PNG圖像(ImageBrush),並在背景中包含一種顏色(SolidColorBrush)。 我想用這兩個標準畫筆創建一個custombrush。使用Png(透明)圖像和背景顏色創建自定義畫筆
感謝您的幫助。
您可以使用VisualBrush。示例
<SolidColorBrush x:Key="MyBackgroundColor" Color="Green"/>
<VisualBrush x:Key="RectangleBrush">
<VisualBrush.Visual>
<Grid>
<Rectangle Fill="{StaticResource MyBackgroundColor}"/>
<Image Source="BackgroundImageSource"/>
</Grid>
</VisualBrush.Visual>
</VisualBrush>
<!-- ... -->
<Rectangle Fill="{StaticResource RectangleBrush}"/>