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.

220 Day 7<br />

NOTE<br />

Most components can be sized. You can place a component on a form and then size it, or you<br />

can size the component at the same time you place it on the form. To size while plac<strong>in</strong>g the<br />

component, click on the form where you want the top-left corner to be placed and then drag<br />

with the mouse until the component is the desired size. When you release the mouse button,<br />

the component will be placed with the size you specified.<br />

TIP<br />

Not all components will allow siz<strong>in</strong>g <strong>in</strong> this manner. Nonvisual components,<br />

for <strong>in</strong>stance, are represented on the form by an icon. Although you<br />

can click-and-drag to place a nonvisual component, the drag size will be<br />

ignored. Another example is a s<strong>in</strong>gle-l<strong>in</strong>e edit component. The edit<br />

component can be placed by dragg<strong>in</strong>g, but only the drag width will be<br />

used. The drag height will be ignored because a s<strong>in</strong>gle-l<strong>in</strong>e edit<br />

component’s height defaults to the height of a s<strong>in</strong>gle-l<strong>in</strong>e edit control.<br />

If you change your m<strong>in</strong>d while plac<strong>in</strong>g the control via the dragg<strong>in</strong>g<br />

method, you can press the Esc key on the keyboard before you release<br />

the mouse button to cancel the operation. The component’s button<br />

will still be pressed on the Component Palette, however, so you may<br />

need to click the Arrow button to return to component-selection mode.<br />

Plac<strong>in</strong>g components is simple enough that we don’t need to spend a lot of time on the subject.<br />

You had some experience with plac<strong>in</strong>g components yesterday, so let’s move on to other<br />

th<strong>in</strong>gs.<br />

The Form Designer Grid<br />

The Form Designer has a built-<strong>in</strong> grid that aids <strong>in</strong> design<strong>in</strong>g forms. By default, <strong>C++</strong>Builder<br />

shows the grid. The grid size is <strong>in</strong>itially set to 8 pixels horizontally and 8 pixels vertically.<br />

When the Form Designer is set to display the grid, a dot is placed at the <strong>in</strong>tersection of each<br />

grid po<strong>in</strong>t. Components placed on a form will snap to the nearest grid po<strong>in</strong>t. By snap to I mean<br />

that the component’s top-left corner will automatically jump to the nearest grid po<strong>in</strong>t. This<br />

is an advantage because you frequently want a group of controls to be aligned either on their<br />

left, right, top, or bottom edges. When the Snap to Grid option is on, you can simply get close<br />

enough to the correct location and the Form Designer will automatically place your<br />

component at the nearest grid po<strong>in</strong>t. This saves you time by sav<strong>in</strong>g you from tweak<strong>in</strong>g the<br />

<strong>in</strong>dividual component’s size or position on the form.

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

Saved successfully!

Ooh no, something went wrong!