Head first C # Chinese Version chapter 13th controls and graphics page580

Source: Internet
Author: User

 

Beecontrol for Renderer
To draw a bee on your form.



 

With a beecontrol
And two forms. Now you only need to place the bees in one way, move them from one form to another, and record their existence. You also need
Filedform
Put the flowers on, but the flowers do not move, this is very simple. These codes can all be put into a new class,
Renderer
. The following are the responsibilities of this class:



 

① The statistical data form will be the parent form of the honeycomb form and pastoral form


 

Add two forms to the project, hiveform
And
Filedform
. Then add code in the constructor of the main form to display its subforms and notify
Windows
The statistic form is their owner.



 

 

 

Child forms are minimized along with the parent form.


 

② The Renderer contains
And reference of each sub-Form



 

The Renderer needs to know the location of each bee and each flower, so it needs world
. It needs to remove and add controls in the child form, so it also needs to reference the child form:



 

 

 

③ The Renderer uses dictionaries to record controls


 

World
List
To record flowers and bees. The Renderer needs to record both the flowers and bees and the corresponding one.
Beecontrol
And
Picturebox --
Alternatively, if the corresponding control is not found, you need to create one. So this is an excellent opportunity to use the dictionary. So
Renderer
Class also requires two fields:



 

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.