WPF Slide Puzzle Game in Vb.NET

In this article, I am trying to create a slide puzzle game in WPF Application.
  • 3033

This article is about a simple 9 piece puzzle game using ImageBrush. In the puzzle one square is blank, and the image portions in the other 8 squares were randomly scattered. 

You had to try and recreate the whole image, by sliding the image portion squares into the blank space, and repeating this until you had the whole image again. Lets see the code snippets for the puzzle: 

Code Sample

<Window x:Class="SlideGame.Window1"
    Title="Window1" Height="300" Width="300">
    <DockPanel LastChildFill="True">
        <Button x:Name="btnPickImage" Content="Pick Image" Click="btnPickImage_Click"DockPanel.Dock="Top"/>
       <!-- Puzzle -->    
<Grid x:Name="gridMain">
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="*"/>

Puzzle Output 


Here we solve the above puzzle and the recreated picture look like as: 


I hope you will enjoy this. 


More Articles

© 2020 DotNetHeaven. All rights reserved.