To improve the image performance, add a method to the Renderer to scale the image. Then we can scale each image after it is loaded, and only in beecontrol
And the version after scaling is used in the honeycomb form.
Do the following:
① Add a resizeimage to the Renderer
Method
All images saved in the project are saved as bitmap
Object format. The following is a static method for scaling an image.
--
Add it
Renderer
Class:
② Give beecontrol
Add this
Resizecells
Method
Your beecontrol
You can store your own
Bitmap
Object
--
In an array. This array can be generated below to scale each image to a proper size:
③ Modify the switch
Statement to make it use
Cells
Array instead of using resources
Beecontrol's
Tick
There is
Switch
Statement, which is used to set its
Backgroundimage
:
Set Properties. Resources. bee_animation_1
Replace
Cells [0]
. Sort other
Case
The code line is also replaced
Cells
So that only the scaled image is displayed.
④ To beecontrol
Add
Resizecells
() Method call
You need to add resizecells twice
() Method call. First, add it to the constructor.
--
Then change
Backgroundimagelayout
The property is
None
. Then add
Beecontrol
Of
Resize
Event processing method, called in it
Resizecells
() Method
--
In this way, the animation is scaled every time the form is scaled.
⑤ Manually set the background of the form
In the Properties window, set the background image of the honeycomb form to none.
. Then, set the image size to the appropriate size in the constructor.
Running the simulator now is much faster!