已經(最終)使用XAML創建了棒球菱形控件。 (代碼如下)。我現在需要在主要職位(1B,2B,SS,3B等)創建「可點擊」文本的能力。該文本還需要旋轉(因爲我畫在角落裏這整個控件,然後在最後旋轉。將可點擊文本添加到DrawingGroup
有人可以幫助將文本添加到我的DrawingGroup
?(BOUNS如果是點擊)。
任何其他意見都表示讚賞,我是WPF的全新人物,所以我甚至不知道我是否正確地做了這件事。我第一次嘗試在代碼中畫了鑽石,但我想挑戰自己在XAML中完全定義它。
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="528.303" Width="582.133">
<Grid Background="#C0E49C">
<Image HorizontalAlignment="Stretch" VerticalAlignment="bottom">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup>
<DrawingGroup.Transform>
<TransformGroup>
<RotateTransform CenterX="0" CenterY="0" Angle="-135" />
<TranslateTransform X="0" Y="-4" />
</TransformGroup>
</DrawingGroup.Transform>
<GeometryDrawing Brush="#FFC080" >
<GeometryDrawing.Pen>
<Pen Brush="Black" Thickness="1"/>
</GeometryDrawing.Pen>
<GeometryDrawing.Geometry>
<GeometryGroup>
<PathGeometry>
<PathGeometry.Figures>
<PathFigureCollection>
<PathFigure StartPoint="0,0">
<PathFigure.Segments>
<PathSegmentCollection>
<LineSegment Point="500,0" />
<BezierSegment Point1="606,350"
Point2="350,606"
Point3="0,500"
/>
<LineSegment Point="0,0" />
</PathSegmentCollection>
</PathFigure.Segments>
</PathFigure>
</PathFigureCollection>
</PathGeometry.Figures>
</PathGeometry>
<RectangleGeometry Rect="8,8,333,333" />
<EllipseGeometry Center="174.5,174.5" RadiusX="50" RadiusY="50" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</Grid>
</Window>
很好,先生。 他有可能在這樣的東西上使用裝飾層嗎?簡單地裝飾他的xaml棒球鑽石的某些元素?我真的在問......不知道。 – 2009-07-30 20:22:39