Click here to Skip to main content
12,402,202 members (66,142 online)
Click here to Skip to main content

Tagged as

Stats

13.6K views
264 downloads
11 bookmarked
Posted

Tile Scaling for Maximum Area Coverage Based Upon Aspect Ratio of Tiles

, 21 Sep 2012 CPOL
This is an algorithm for maximizing coverage of a rectangular area with scaling tile children.
ScalingTiles
ScalingTiles.suo
ScalingTiles.v11.suo
ScalingTiles
bin
Debug
ScalingTiles.vshost.exe.manifest
Release
ScalingTiles.vshost.exe.manifest
obj
x86
Debug
GenerateResource.read.1.tlog
GenerateResource.write.1.tlog
Release
Properties
ScalingTiles.suo
ScalingTiles.v11.suo
ScalingTiles.vshost.exe.manifest
ScalingTiles.vshost.exe.manifest
GenerateResource.read.1.tlog
GenerateResource.write.1.tlog
<Window x:Class="ScalingTiles.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Shawn Pavel's Scaling Tiles" Height="350" Width="525">
    <!--Root-->
    <DockPanel>
        <!--
            Children Count Option
            Default is Four 
        -->
        <StackPanel Orientation="Horizontal" VerticalAlignment="Top" DockPanel.Dock="Top">
            <TextBlock Text="Number of Child Rectangles:" VerticalAlignment="Center"/>
            <TextBox x:Name="txtRectangles" Text="4" Margin="5,0" MinWidth="50"  />
        </StackPanel>
        <!--
            Aspect Ratio Option
            Default is 1.33
        -->
        <StackPanel Orientation="Horizontal" VerticalAlignment="Top" DockPanel.Dock="Top">
            <TextBlock Text="Aspect Ratio:" VerticalAlignment="Center"/>
            <TextBox x:Name="txtAspectRatio" Text="1.3333" Margin="5,0" MinWidth="50"/>
            <Button x:Name="btnUpdateRectangles" Content="Update" Click="btnUpdateRectangles_Click" />
        </StackPanel>
        <!--
            Status and Test Info Display
        -->
        <Grid DockPanel.Dock="Top">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <TextBlock x:Name="txtStatus" Text="No status yet" HorizontalAlignment="Center" />
            <TextBlock x:Name="txtMaximized" Text="" HorizontalAlignment="Center" Grid.Row="1"/>
        </Grid>

        <!--    
            WrapPanel to take care of position of the children
        -->
        <Border x:Name="brdRectangles" BorderBrush="Black" BorderThickness="1" Margin="5" CornerRadius="5">
            <WrapPanel x:Name="wpParentContainer" ItemHeight="50" ItemWidth="50" SizeChanged="wpParentContainer_SizeChanged_1" />
        </Border>
    </DockPanel>
</Window>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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

Share

About the Author

Shawn_P
United States United States
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160721.1 | Last Updated 21 Sep 2012
Article Copyright 2011 by Shawn_P
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid