C++ Builder is a great IDE which comes with the FireMonkey UI framework. While Firemonkey is a powerful multi-platform UI framework which lets you create apps which work on desktop as well as mobile phones and tablets you can also use it to add many shape types to your C++ app on Windows.
TShape is the ancestor class to most other classes defined in the Objects unit. It defines the common behavior–methods and properties–for 2D graphic primitives. TShape objects cannot be used as stand-alone 2D components.
The base class for 2D graphic primitives–TLines, TRectangles, TPaths, and others. All these primitives inherit TControl and can be used in styles to construct controls.
The base class for 2D graphic primitives–TLines, TRectangles, TPaths, and others. All these primitives inherit TControl and can be used in styles to construct controls.
In C++ Builder you can directly create your own 3D objects, you can animate them on runtime. Viewport3D (TViewportd3D) component in C++ Builder FireMonkey projects is good to display many basic 3D Objects like Plane, Cube, Sphere, Cone, Plane, Ellipse3D etc. You can also easily load your 3D objects into Viewport3D by using Model3D (TModel3D).
Rectangle (TRectangle)
TRectangle defines 2D rectangles with customized corners. It inherits TControl and can be used in styles to construct controls. You can create a rectangle shape as below,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
TRectangle *R; R = new TRectangle(Form1); R->Position->X = 0; R->Position->Y = 0; R->Width = 200; R->Height = 400; R->Fill->Color = claLime; R->Parent = Form1; R->Opacity = 0.5; R->Visible = true; |
At the end of usage, we should free this rectangle from the memory as below,
1 2 3 |
R->Free(); |
Ellipse (TEllipse)
TEllipse defines 2D ellipses. It inherits TControl and can be used in styles to construct controls.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
TEllipse *R = new TEllipse(Form1); R->Position->X = 0; R->Position->Y = 0; R->Width = 300; R->Height = 200; R->Fill->Color = claYellow; R->Parent = Form1; R->Opacity = 0.5; R->Visible = true; |
At the end usage, we should free this rectangle from the memory as below,
1 2 3 |
R->Free(); |
Other 2D objects are about same as in given examples above.
Did you know you can download a free trial of C++ Builder?