# VBForums CodeBank > CodeBank - C# >  C# - Crack the Lock

## .paul.

This is an example of effective GDI+ programming in WinForms. The screenshot below shows a fairly extensive Form, but there is actually only a Panel, containing just four controls. All of the rest is GDI+ drawing, directly onto the Panel. The aim of the game is to crack the combination and open the lock. There are five sets of clues to assist you incracking the lock. When you select the correct combination the lock picture changes showing an open lock. Simple animations are easily achieved with GDI+. Everything, from the rounded rectangle clue boxes to the padlock images is drawn directly to the Panel. DoubleBuffering the Panel makes the animations and the redrawing a seamless operation.The rounded rectangles are probably the most difficult part of this application. Microsoft doesn't provide a rounded rectangle in the GDI+ toolbox, but it does provide a DrawPath method and a FillPath method. If you map out the shape required with a Drawing2D GraphicsPath, it's possible to draw any irregular shapes you need.For the more experienced programmer, a simple but effective and still challenging game such as this can be written in a matter of hours. Using OOP Techniques when tackling a program such as this can save a lot of time and the resulting application is easy to maintain or modify/extend in the future.

Try the Javascript version online



Crack the Lock_ cs.zip

----------


## OptionBase1

289?

Cool idea, by the way.

----------


## .paul.

> 289?
> 
> Cool idea, by the way.


Thanks :thumb

----------


## OptionBase1

I took a second look at the image and I see that the answer is present in your screenshot, albeit tiny and hard to read.  I figured it out all on my own, I swear!  LOL

----------


## .paul.

> I took a second look at the image and I see that the answer is present in your screenshot, albeit tiny and hard to read.  I figured it out all on my own, I swear!  LOL


 :Big Grin:  The app is bigger than the screenshot. I had to shrink it for some other sites, and i used that image...

----------

