Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I've got a button control in XAML as follows:
XML
<Button HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0" Height="120" Width="110" x:Name="Button" Background="GreenYellow" Content="1" BorderBrush="sc#1, 0, 0, 0" Foreground="DarkGreen" FontSize="72">
    <Button.Template>
        <ControlTemplate TargetType="{x:Type Button}">
            <Grid Width="Auto" Height="Auto" x:Name="Grid">
                <Path Stroke="{TemplateBinding BorderBrush}" Fill="{TemplateBinding Background}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Width="Auto" Height="Auto" x:Name="Path" RenderTransformOrigin="0.5,0.5" Stretch="Fill" Data="M60,0 L100,20 100,55 60,75 20,55 20,20 60,0 z"/>
                <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0" x:Name="TextBlock" Text="{TemplateBinding Content}" TextWrapping="Wrap" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" FontStretch="{TemplateBinding FontStretch}" Foreground="{TemplateBinding Foreground}"/>
            </Grid>
        </ControlTemplate>
    </Button.Template>
</Button>

I want to arrange these buttons in a hexagon pattern of 4x4x4x4x4x4 or 5x5x5x5x5x5.
Ideally i'd like the size of the hexagon pattern to be variable and perhaps even the shape too.

Any help appreciated...
Posted
Updated 13-Oct-12 9:18am
v2

1 solution

Its not so difficult:
http://en.wikipedia.org/wiki/Hexagon[^]
http://www.mathopenref.com/constinhexagon.html[^]

The second method is probably the easiest, as the radius of the circle, would give you each of the sides in a hexagon.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900