The power of parenting
One of the nicest things about the FireMonkey architecture is parenting. Essentially, any FireMonkey component can contain, or be a parent to, other components. What is cool about it is the fact that all the children inherit different properties of their parents, such as position, scale, and rotation. This also gives a lot of possibilities in building user interfaces because we can create composite controls without having to declare completely new classes.
Shapes
A lot of low-level drawing code can be avoided by using different controls from the Shape
category on the Tool Palette
. There are lines, circles, ellipses, rectangles, pies, paths, and more. They just encapsulate drawing on the canvas, so you need not write so much code.
Let's try to recreate our sun visualisation with shapes to better compare these two possible approaches to drawing. Add a new Form HD
to the project. Drop the TRectangle
component on the form and align it to Client
. Change its Name
property to...