本文介绍了如何创建具有例如形状的画笔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面的代码显示了a现在如何结合两个矩形来创建画笔.
是否有更快/更快/更少的cpu创建包含形状的画笔的方法?
Hi,
Next code shows how a now combine two rectangles to create a brush.
Is there a quicker/faster/less cpu way to create a brush which contains shapes?
Dim R As New Shapes.Rectangle
R.Stretch = Stretch.Fill
R.Width = 200
R.Height = 200
R.Fill = Brushes.Red
Dim R2 as New Shapes.Rectangle
R2.Stretch = Stretch.Fill
R2.Width = 50
R2.Height = 50
R2.Fill = Brushes.Green
'combine the two rectangles
Dim G As New Grid
G.Children.Add(R)
G.Children.Add(R2)
'create a visual brush
Dim myVisualBrush As New VisualBrush
myVisualBrush.Stretch = Stretch.Fill
myVisualBrush.Visual = G
SomeCanvas.Background = myVisualBrush
推荐答案
这篇关于如何创建具有例如形状的画笔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!