Home

GDI Tools: Cursors

 

The Image Editor

 
 

Introduction

 

C++ Builder ships with a graphic application called Image Editor. Image Editor is used to create or manipulate small to medium, various types of, pictures needed in computer and graphic applications. These graphics are divided in categories that have different roles. Image Editor provides pens and brushes used to design its objects

Starting Image Editor

 

There are various ways you can launch Image Editor:

  • If you had started C++ Builder, to start a graphic, on the main menu of C++ Builder, you can click Tools -> Image Editor
  • Image Editor is installed in the same group as C++ Builder. To start Image Editor at anytime, from the taskbar, you can click Start -> (All) Programs -> Borland C++ Builder -> Image Editor
  • Image Editor is installed in the same location as C++ Builder. Therefore, in Windows Explorer or My Computer, locate C:\Program Files\Borland\Cbuilder6\Bin, and double-click imagedit or imagedit.exe

Using the Image Editor

 

When Image Editor appears, it is mainly made of four areas.

On top, there is the title bar that displays Image Editor and the main menu. The title bar has the same classic look shared by Windows applications. Under the title bar, the menu, here called the main menu, allows you to perform all regular operations of an application. Image Editor is a Multiple Document Interface (MDI) application. This means that it allows you to open or work on different child windows. By default, when Image Editor starts, it does not create a new document. To create a graphic, you will have to let Image Editor know what kind of graphic you want to work on. Once you open or start a new document, the menu would change according to the type of graphic you are using.

To open an existing document, on the main menu, you can click File -> Open… and locate the desired document. To create a new document, on the main menu, you would click File -> New… and select the type of document you want.

The menu is used as on all other documents. For example, if you make a mistake on a graphic and want to dismiss the last action, you can click Edit -> Undo or press Ctrl + Z. In the same way, you can copy by clicking Edit -> Copy or pressing Ctrl + C. In other words, most of the shortcuts you are familiar with are available.

On the left side of the application, the Tools Palette displays buttons that will be used to create new graphics or manipulate existing ones.

To find out what a button is used for, position the mouse on top. A tool tip, or hint, would display. The buttons are used for various goals and exhibit different behaviors.

 

Some tools such as the Pencil, lines, and the geometric shapes (rectangle, round rectangle, and ellipse) allow you to specify a width for their lines.
Some tools such as the Brush or the Spray allow you to select a thickness for the dot or mark they would apply to a graphic. To access this change, first select the Brush or Spray, then, in the lower section of the Tools Palette, select the the thickness you want.

If you change the default line width of a tool, the selected width or thickness stays in memory and can be applied to a tool that does not obviously display this option. This happens if you a great width for a rectangle and then decide to use a Filled Rectangle tool, the last width would apply to the new tool. Therefore, if you do not want to use the same width, select the default before using another tool.

The main area of the application is made of a wide black rectangle that is used to host the graphics you will be using.

Like the top section, the bottom area of the application contains two objects. The Color Palette displays a list of 16 colored buttons (by default)

Under the Color Palette, there is the Status Bar.

After using Image Editor, you can close it. You have a few alternatives:

  • On the main menu, you can click File -> Exit
  • The shortcut to close such an application as Image Editor is Alt + F4
  • To close Image Editor, you can press either Alt, f, x or Alt + X

When closing Image Editor, if you had a modified document that needs to be saved, you would be prompted to save it.

Graphics used in the Windows operating system are divided in categories. Probably the most popular of the graphics natively used in the operating system is called a bitmap.

Introduction

Cursors are another type of application accessory you can design using pens and brushes in Image Editor. A cursor is a small graphic that represents the position of the mouse on a Windows screen. Because Windows is a graphic-oriented operating system, when it installs, it creates a set of standard or regularly used cursors. These can be seen by opening the Control Panel window and double-clicking the Mouse icon. This opens the Mouse Properties dialog box where you can click the Pointers tab to see a list of standard cursors installed by Windows:

Creating Cursors

Microsoft Windows installs a wide array of cursors for various occasions. Besides the cursors provided by Windows, Borland C++ Builder installs additional cursors that can accommodate even more scenarios. If these are still not enough, you can create your own cursors. Using your own, custom cursors involves more steps than using bitmaps and icons.

To create your own cursor, on the main menu of Image Editor, you can click File -> New -> Cursor File (.cur). A starting but empty cursor would be displayed. After designing a cursor, you must save it. It has an extension of .cur.

Essentially, a cursor uses only two colors, black or white. This is because a cursor is only used as an indicator of the presence or position of the mouse pointer on the screen. Based on this (limitation), you ought to be creative. The minimum you can give a cursor is a shape. This can be a square, a rectangle, a circle, an ellipse, a triangle, or any shape of your choice. You can make the cursor fully black by painting it with that color. If you decide to make the cursor completely white, make sure you draw the borders of the cursor. By playing with the frequency of pixels and varying the frequencies of black and white, you can create variances of gray.

Between the black and white colors, two gray degrees are provided to you. In reality these two colors are used to give a transparency to the cursor so the background can be seen when the mouse passes over a section of the document.

Practical Learning Practical Learning: Creating a Cursor

  1. On the main menu of Image Editor, click File -> New… -> Cursor File (.cur)
  2. On the Tools Palette, click the Fill button and right-click the drawing area to give it a white background
  3. On the Tools Palette, click the Line tool
  4. In the line width section, make sure the top line is selected. In the Color Palette, make sure the black color is selected
  5. Draw a vertical line from the pixel on the 6th column and 2nd row from top
  6. Draw a diagonal line at 45˚ from the top border of the new line to the lower-right until the line is at 5 pixels from the right border of the drawing area
     
  7. Draw a horizontal line from the lower border of the dialog line to half-left
  8. Draw a diagonal line from the lower border of the vertical line to the left border of the horizontal line:
     
  9. Draw another diagonal line from the top corner of the current shape to the intersection of horizontal and left diagonal line:

  10. On the Tools Palette, click Fill
  11. On the Color Palette, click the button with a red color and a green S
  12. On the drawing area, click the right triangle
  13. On the Color Palette, click the button with a green background and a red S
  14. On the drawing area, click in the left triangle

  15. To test the cursor, on the main menu, click Cursor -> Test…
  16. Draw a curved line. After previewing the cursor, click Close
  17. On the Color Palette, right-click the button with a green background and a red S
  18. On the drawing area, right-click outside of the shape to apply the necessary background
  19. In the Color Palette, click the black color and click inside the left triangle
  20. In the Color Palette, click the white color and click inside the right triangle
  21. To set the position of the cursor pointer, on the main menu, Cursor -> Set Hot Spot…
  22. Change the Horizontal (X) value to 5 and change the Vertical (Y) value to 1
     
  23. Click OK
  24. To test the cursor, on the main menu, click Cursor -> Test…
  25. Draw various shapes
     
  26. After previewing the cursor, click Close
  27. Save the cursor as Push in the Cursors folder but do not close the cursor window

 

Home Copyright © 2005-2012, FunctionX, Inc.