This tutorial guides you through the essentials of the Painting Board Tool. It assumes you have created a new painting board file (select File | New, and search in the different categories for Painting Board).
The painting board allows you to write some painting code and see the result instantaneously.
The typical window layout and code view is shown in Figure 1.
Figure 1. Painting board drawing and code view.
// Create pen.
Pen blackPen = new Pen(Color.Black, 3);
// Create array of rectangles.
RectangleF[] rects =
{
new RectangleF( 0.0F, 0.0F, 100.0F, 200.0F),
new RectangleF(100.0F, 200.0F, 250.0F, 50.0F),
new RectangleF(300.0F, 0.0F, 50.0F, 100.0F)
};
// Draw rectangles to screen.
e.Graphics.DrawRectangles(blackPen, rects);
You can add code for variables and methods that you can directly call from the Input Area. You also have the option to add full class declarations that you can call from the Input Area.
To add code for variables and methods, switch to Code View (from the View menu, or by clicking the Code button at the bottom of the window). Select Painting Board > Declarations in the Fragment List on the left, and add the code for variables and methods in the text editor.
To add additional namespace/class declarations, switch to Code View. Select Build Options > UserCode in the Fragment List. Add the code for new namespaces and classes.
See the Immediate Execution Tutorial for more on how to use the Declarations and UserCode fragments.
In most basic cases, you don't have to do anything else to view painting code in action. Simply type the drawing instructions, build the Painting Board, and the program will display the result.
However, there are cases where you want to change some settings, such as the language and referenced files and assemblies. This topic explains how to change these settings.
Copyright © Q. Binh Dam 2004-2007. Last modified: 27 Aug. 2007.