Results 1 to 5 of 5

Thread: C# - Crack the Lock

  1. #1

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,685

    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

    Name:  660px.jpg
Views: 1236
Size:  28.9 KB

    Crack the Lock_ cs.zip
    Last edited by .paul.; Jan 10th, 2020 at 08:16 PM.

  2. #2
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,341

    Re: C# - Crack the Lock

    289?

    Cool idea, by the way.

  3. #3

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,685

    Re: C# - Crack the Lock

    Quote Originally Posted by OptionBase1 View Post
    289?

    Cool idea, by the way.
    Thanks :thumb

  4. #4
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,341

    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

  5. #5

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,685

    Re: C# - Crack the Lock

    Quote Originally Posted by OptionBase1 View Post
    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...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width