Another talk on C # minesweeper

Source: Internet
Author: User

It seems that we all like the topic of mine clearance. Thank you for pointing out the problem in my code, here Xu Xiaoxia wrote a good implementation:

Http://www.cnblogs.com/Chinese-xu/archive/2009/04/29/1446415.html

At the same time he pointed out that I did not fully follow the object-oriented approach to design, in fact this originated from the design of my original intention, here to clarify.

When I first realized a minecontrol, I didn't think about putting all the logic into the Minecontrol class. I think Minecontrol in fact and WinForm in the ordinary button,label such as no difference, is a view, used to display. Only Minecontrol is dedicated to show a button in the mine clearance, so there will be different display states such as 123456789,flag,questionmark. Simply put, the Minecontrol is responsible for how to display the problem, as to when to show, what to display, these logic should be stripped and control. In my design, Minecontrol is just a view, the concrete logic should not appear in it.

So you can see in my code, some specific logic, such as the left mouse button MouseDown, around the key double-click, the point of the white space, and so on, these specific logic are implemented in the Form1. Form1 based on user input to determine what these minecontrol should be, and then through the unseal (), press () and other interfaces to change the interface. The benefit of doing this is obvious: we don't need to care about the details of the display when we implement the logic, The structure of the program will look clearer.

In fact, everyone's design will have their own understanding, such discussions benefited a lot, I believe that more to see the realization of others, their own improvement is a great help. ^^

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.