-
Mar 22nd, 2019, 07:05 PM
#1
C# - Crack the Lock
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
Last edited by .paul.; Jan 10th, 2020 at 08:16 PM.
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 22nd, 2019, 07:27 PM
#2
Re: C# - Crack the Lock
289?
Cool idea, by the way.
-
Mar 22nd, 2019, 08:26 PM
#3
Re: C# - Crack the Lock
Originally Posted by OptionBase1
289?
Cool idea, by the way.
Thanks :thumb
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 22nd, 2019, 08:34 PM
#4
Re: C# - Crack the Lock
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
-
Mar 22nd, 2019, 08:59 PM
#5
Re: C# - Crack the Lock
Originally Posted by 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
The app is bigger than the screenshot. I had to shrink it for some other sites, and i used that image...
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|