12.12.2012 Views

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

NOTE<br />

Work<strong>in</strong>g with the Form Designer and the Menu Designer<br />

After a paste operation, the component just pasted will be selected.<br />

5. Double-click the Brush property and change the Color property under Brush to<br />

clBlack. The new shape is now black, but it is on top of the orig<strong>in</strong>al shape. Can’t<br />

have that!<br />

6. Click the secondary mouse button and choose Send to Back from the speed menu<br />

(you could also choose Edit | Send to Back from the ma<strong>in</strong> menu). The black shape<br />

is moved beh<strong>in</strong>d the white shape. You now have a box with a shadow. (As an<br />

alternative, we could have clicked on the white shape and used Br<strong>in</strong>g to Front to<br />

move it on top of the black shape.)<br />

This exercise illustrates two features of the Form Designer. It shows how you can change the<br />

stack<strong>in</strong>g order of controls, and also that you can use Copy and Paste to copy components.<br />

The orig<strong>in</strong>al component’s properties are copied exactly and pasted <strong>in</strong> as part of the past<strong>in</strong>g<br />

process. Each time you paste a component, it is placed below and to the right of the previous<br />

component pasted.<br />

NOTE<br />

If a component that can serve as a conta<strong>in</strong>er is selected when you<br />

perform a paste, the component <strong>in</strong> the Clipboard will be pasted as a<br />

child of the conta<strong>in</strong>er component. For <strong>in</strong>stance, you might want to<br />

move a button from the ma<strong>in</strong> form to a panel. You could select the<br />

button and then choose Edit | Cut from the ma<strong>in</strong> menu to remove the<br />

button from the form and place it <strong>in</strong> the Clipboard. Then you could<br />

select the panel and choose Edit | Paste from the ma<strong>in</strong> menu to paste<br />

the button onto the panel.<br />

I don’t need to go <strong>in</strong>to a lot of detail on the cut operation. When you cut a component, the<br />

component disappears from the form and is placed <strong>in</strong> the Clipboard. Later you can paste the<br />

component onto the form or onto another component, such as a Panel component.<br />

Siz<strong>in</strong>g Components<br />

With some components, you drop them on a form and accept the default size. Buttons are<br />

a good example. A standard button has a height of 25 pixels and a width of 75 pixels. For many<br />

situations, the default button size is exactly what you want. With some components,<br />

however, the default size is rarely exactly what you need. For example, a Memo component<br />

nearly always has to be sized to fit the specific form on which you are work<strong>in</strong>g.<br />

229<br />

7

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!