0
是否有人可以帮助我,给图像添加到本教程的每个菜单项:WPF - 自定义转盘菜单 - 菜单项图像
http://www.codeproject.com/Articles/522343/A-Pie-Menu-for-WPF
我不知道,如何做到这一点。
是否有人可以帮助我,给图像添加到本教程的每个菜单项:WPF - 自定义转盘菜单 - 菜单项图像
http://www.codeproject.com/Articles/522343/A-Pie-Menu-for-WPF
我不知道,如何做到这一点。
试试这个:
</MyNamespace:PieMenu.BitmapEffect>
<Image Source="Items\1.png" Width="50" Height="50"/>
<Image Source="Items\2.png" Width="50" Height="50"/>
<Image Source="Items\3.png" Width="50" Height="50"/>
<Image Source="Items\4.png" Width="50" Height="50"/>
<Image Source="Items\5.png" Width="50" Height="50"/>
</MyNamespace:PieMenu>
我有类似的问题。我结束了玩PieMenuItem的头部属性。像这样的东西会奏效。
if (menu_item.Header as FrameworkElement != null)
{
FrameworkElement header = (FrameworkElement)menu_item.Header;
// Create the visual brush based on the UserControl
VisualBrush headerVisualBrush = new VisualBrush(header);
headerVisualBrush.Stretch = Stretch.Uniform;
// Draw using the visual brush in the rect
double contentSize = distance/2;
drawingContext.DrawRectangle(headerVisualBrush, null, new Rect(center.X - contentSize/2.0, center.Y - contentSize/2.0, contentSize, contentSize));
}
else if (menu_item.Header as String != null)
{
}
不......不幸的是,这是行不通的。编译器说,“Image”不受“BitmapEffect”属性支持。 – Maximus1809