Your control inherited from the System::Windows::Form::Control class, and due to this, your control contains a lot of stock properties. In fact, not only do these properties exist, but you don't have to provide any implementation for them because they have already been implemented for you by the base class. Within your Visual C# project you just created, click the ShapeControl you added to the Windows Form within the Windows Form Designer. At the bottom-right area of the IDE, you should see a window named Properties. Within that window, you can see several stock properties that have been created for you already.
Scroll down the list of properties until you find the property named BackColor. Click the field of that property and then click the down-arrow button to display the available colors you can choose. Select a color other than the one currently displayed by clicking it. Once you do that, your ShapeControl will automatically change its color based on the color you chose. As you'll recall when you created the control, your PaintHandler method draws the rectangle or ellipse based on the property ForeColor. Find the ForeColor property in the list of properties and choose another color. Your rectangle should now be drawn with a different color. Figure 23.10 shows a Windows Form with several ShapeControls, each with different values for their stock properties.
In addition to different colors, you can also resize your control, add a background image, dock it to the side of the form, and even cause the cursor to change when the user passes the mouse cursor over the control during runtime. Currently, however, there is no way to change the control from a rectangle to an ellipse. You will now do this by adding a custom property for your control.
Figure 23.10 Stock properties free you from having to implement properties common among all controls.