O'Reilly logo

Expert Delphi by Paweł Głowacki

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 rectSky. Expand its Fill property and change Color to Skyblue. Drop the TCircle component on the form and name it circleSun. Change its Width and Height properties to 100 to make it bigger, and its Position.X and Position.Y

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required