アットウィキロゴ

開発部 > 技術 > Visual Studio 2008 > WPF > 駐停車禁止っぽいボタン

道路標識の「駐停車禁止」っぽいボタンを作ってみた。
Grid部分をTemplate化すれば、いろんなところで使えるかも。
ボタンのサイズは17×17と小さ目を考えているので、大きくして使う人はStrokeThicknessプロパティを大きくする必要があります。
さらに、縦横比1:1という制限つき(^~^)
使えないか。。。。?

  1. <Button Name="Button2" Height="17" Width="17">
  2. <Button.Template>
  3. <ControlTemplate>
  4. <Grid>
  5. <Grid.ColumnDefinitions>
  6. <ColumnDefinition Width="20*" />
  7. <ColumnDefinition Width="100*" />
  8. <ColumnDefinition Width="20*" />
  9. </Grid.ColumnDefinitions>
  10. <Grid.RowDefinitions>
  11. <RowDefinition Height="20*" />
  12. <RowDefinition Height="100*" />
  13. <RowDefinition Height="20*" />
  14. </Grid.RowDefinitions>
  15. <Ellipse Grid.ColumnSpan="3" Grid.Column="0"
  16. Grid.RowSpan="3" Grid.Row="0"
  17. Stroke="Red" StrokeThickness="3"
  18. Fill="Blue" />
  19. <Line Grid.Column="1" Grid.Row="1"
  20. X1="0" Y1="0" X2="20" Y2="20"
  21. Stroke="Red" StrokeThickness="3"
  22. Stretch="Uniform"></Line>
  23. <Line Grid.Column="1" Grid.Row="1"
  24. X1="0" Y1="20" X2="20" Y2="0"
  25. Stroke="Red" StrokeThickness="3"
  26. Stretch="Uniform"></Line>
  27. </Grid>
  28. </ControlTemplate>
  29. </Button.Template>
  30. </Button>
  31.  
最終更新:2009年04月27日 16:44
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。