Moving Controls Vertically
|
|
When a control has been selected, as your mouse moves
over it, its pointer displays a different cursor. One of these cursors can
be used to move a control. This cursor is represented as a cross with four
arrows:
By default, when dragging the control(s), it(they)
move(s) by one unit of the grid lines on the form or report and you can move
left, right, up, or down but:
- If you want to move one control vertically one unit of grid lines at
a time, click the control and press the down or the up arrow keys a few
times until you get the distance you want
- If you want to move a group of controls vertically one unit of grid
lines at a time, select the controls and press the down or the up arrow
keys a few times until you get the distance you want
- If you want to move one control vertically one unit of grid lines at
a time, first deselect the controls (make sure no control is selected),
press and hold Shift, then click the control and immediately drag the
mouse up or down. When you get to the desired location, release the
mouse and release Shift
- If you want to move many controls vertically one unit of grid lines
at a time, first deselect the controls (make sure no control is
selected), press and hold Shift, click each control except the last (for
example if you want to move four controls vertically, press and hold
Shift, then click the first three). When you get to the last control of
the group (for example the 4th), click it and immediately drag (don't
release after clicking) the mouse up or down. When you get to the
desired location, release the mouse and release Shift
- If you want to move one control vertically without following the
grid lines, first deselect the control(s) (make sure no control is
selected). Press and hold Ctrl + Shift. Click and immediately drag the
control up or down. When you get to the desired location, release the
mouse and Ctrl
- If you want to move many controls vertically without following the
grid lines, first deselect the control(s) (make sure no control is
selected). Press and hold Ctrl + Shift. Click each control except the
last to select them. When you get to the last control of the desired
group, click and immediately drag up or down. When you get to the
desired location, release the mouse, the Shift and the Ctrl keys
You can also move the controls vertically using the
Properties window:
- To move one control, change the value of its Top field
- To move many controls, first select them. Then, in the Properties
window, change the value of the Top field
Practical
Learning: Moving Controls Vertically
|
|
- Click the CompanyAssetID label on the form
- Position the mouse on the upper left corner of the selected label
until the cross cursor appears:
- Click and drag up and left to move the label so that its left border
aligns with the 1/4 measure of the horizontal ruler and its top border
aligns with the 1/8 measure of the vertical ruler:
- Release the mouse
- Save the form
Aligning Controls Vertically
|
|
Consider the following form:
One of the obvious problems is that this layout does not
follow any reasonable logic. Among the remedies to this, you can better
align the controls. For example, you may want the First Name label, the top
Unbound text box, the MI label and its text box to have the same distance
from the top border of the form. Aligning the controls consists of using a
reference to position other controls based on this reference. Fortunately,
Microsoft Access provides all the necessary tools to align the controls on a
form or report.
To assist you with aligning the controls on a form or a
report, the Ribbon provides the Control Formatting section in the Format
tab. To access it, while the form or report is in Design View, on the
Ribbon, click Format. You will see the section labeled Control Alignment:
Before aligning some controls you must first decide
which one would be used as a reference. This means that you can use the
alignment of one control as a reference for the other controls. To do this,
position that control as the others should be aligned vertically. For
example, imagine that, from the above form, you want to position the First
Name label, its text box, the MI label, and its text box to have the same
distance from the top border of the form. You can start by positioning one
of these control at the top distance you want. Here is an example:
After doing this, the alignment of such a control, in
this case the top alignment of the First Name label, can be used to align
the First Name text box, the MI label, and the MI text box. To align the
other controls, first select them. Here is an example:
To align the controls:
- In the Sizing & Ordering section of the Arrange group of the
Ribbon, click Align and click To Top button

- Right-click one of the selected controls, position the mouse on
Align, and click Top.
Here is the result from the above selection:
In the same way, you can align other controls. You can
also align controls to the bottom: first align the one that would be used as
the reference, select the others, and click the Bottom button in the Control
Alignment section of the Ribbon. You can also right-click one of the
controls in the selection, position the mouse on Align, and click Bottom.
Practical
Learning: Aligning Controls Vertically
|
|
- On the form, click the CompanyAssetID label to select it
- Press and hold Shift
- Click the CompanyAsset text box to have the label and the text box
selected

- On the Ribbon, click Arrange. In the Sizing & Ordering section,
click Align and click Top
- Save the form
Moving Controls Horizontally
|
|
Instead of moving the control(s) randomly or vertically,
you can move it(them) horizontally only:
- If you want to move one control horizontally one unit of grid lines
at a time, click the control and press the right or left arrow keys a
few times until you get the distance you want
- If you want to move a group of controls horizontally one unit of
grid lines at a time, select the controls and press the right or the
left arrow keys a few times until you get the distance you want
- If you want to move one control horizontally one unit of the grid
lines at a time, first deselect the controls (make sure no control is
selected), press and hold Shift, then click the control and immediately
drag the mouse left or right. When you get to the desired location,
release the mouse and release Shift
- If you want to move many controls horizontally one unit of grid
lines at a time, first deselect the controls (make sure no control is
selected), press and hold Shift, click each control except the last of
the desired group. Click the last control and immediately drag the mouse
left or right. When you get to the desired location, release the mouse
and release Shift
- If you want to move one control only horizontally without following
the grid lines, first deselect the control(s) (make sure no control is
selected), press and hold Ctrl + Shift. Click and immediately drag the
mouse left or right. When you get to the desired location, release the
mouse, the Shift and the Ctrl keys
- If you want to move many controls only horizontally without
following the grid lines, first deselect the control(s) (make sure no
control is selected). Press and hold Ctrl + Shift. Click each control
except the last to select them. When you get to the last control of the
desired group, click and immediately drag left or right. When you get to
the desired location, release the mouse, the Shift and the Ctrl keys
You can also move the controls horizontally using the
Properties window:
- To move one control, change the value of its Left field
- To move many controls, first select them. Then, in the Properties
window, change the value of the Left field
Practical
Learning: Moving Controls Horizontally
|
|
- On the form, click the Date Acquired text box
- Press and hold Shift
- Click the following text boxes: Category, Make, Model, and Purchase
Price
- Release Shift
- Press the right arrow key 20 times
- Save the form
Aligning Controls Horizontally
|
|
Imagine you want to position some labels of the above
form to the left. You can start by positioning the First Name label to the
desired left distance:
After doing this, the alignment of such a control, in
this case the First Name label, can be used as a reference for the others.
To align the other controls, first select them. Here is an example:
Notice that only the controls that will be aligned, in
this case only some labels, have been selected. To align them:
- In the Size & Ordering section of the Arrange group of the Ribbon,
click Align and click

- Right-click one of the controls in the selection, position the mouse
on Align, and click Left
Here is the result from the above selection:
In the same way, you can align other controls. You can
also align controls to the right: first align the one that would be used as
the reference, select the others, and click the Right button in the Control
Alignment section of the Ribbon.
Practical
Learning: Aligning Controls Horizontally
|
|
- On the form, click the CompanyAssetID label
- Press and hold Shift
- Click the following labels: Date Acquired, Category, Make, Model,
and Purchase Price
- On the Ribbon, click Arrange if necessary. In the Sizing & Ordering
section, click Align and click Left

- On the form, click the CompanyAsset text box
- Press and hold Shift
- Click the following text boxes: Date Acquired, Category, Make,
Model, and Purchase Price
- Right-click Make (or one of the selected controls), position the
mouse on Align, and click Left

- Click the button at the intersection of the rulers

- Save the form
The size of a control is both:
- The distance from its left to its right borders: its width
- The distance of its top to its bottom borders: its height
When you add a control to a form or report, it assumes a
certain size depending on the type of control. In some cases, you will want
to change the size the a control. Resizing a control consists of changing
its measures. There are various ways you can do this.
Resizing a control consists of changing either its
width, its height, or both. Before resizing a control, first select it. To
resize a selected control, position the mouse on one of its borders. When
the mouse moves over a selected control and reaches one of the handles, the
mouse pointer displays a double-arrow cursor. The possible mouse pointers
are:
Cursor |
Role |
 |
Shrinks or heightens the control |
 |
Resizes the control in North-East <-> South-West
direction |
 |
Narrows or widens the control |
 |
Resizes the control in North-West <-> South-East
direction |
Although these pointers can be used to resize one
control, they can also be applied to a group of controls. Based on this:
- To resize a control along the grid lines, select it first. Position
the mouse on one of the handles to seize the cursor of your choice.
Click and drag in the desired and appropriate direction
- To resize a control without following the grid lines, select it
first. Press and hold Ctrl. Position the mouse on one of the handles to
seize the cursor of your choice. Click and drag in the desired and
appropriate direction
Practical
Learning: Resizing a Control
|
|
- On the form, click the CompanyAsset text box
- Position the mouse on the middle handle of its right border

- Click and drag left until the right border of the text box aligns
with the 2 measure of the horizontal ruler

- Release the mouse

- Save the form
Resizing Various Controls
|
|
Instead of one, you can also resize a group of controls
at the same time:
- To resize more than one control along the grid lines, select them.
Position the mouse on one of the handles of the selected controls to get
the desired cursor. Click and drag appropriately. all of the selected
controls would be resized
- To resize more than one control without following the grid lines,
select them first. Press and hold Ctrl. Position the mouse on one of the
handles of the selected controls to get the desired cursor. Click and
drag appropriately. all of the selected controls would be resized
To further assist you with resizing a control, Microsoft
Access provides the Size/Space button of the Ribbon. To access it, while the
form or report is in Design View, click Arrange. To resize a group of
controls, first select one and set the desired size, such as the desired
width. Consider the following form:
Imagine you would like the First Name text box, the Last
Name text box, and the Gender combo box to have the same dimensions. First
select the controls that will be resized:
To resize the controls:
- On the Ribbon, click Arrange. Click the Size/Space button and use
the options in the Size section:
- Click one of the selected controls, position the mouse on Size, and
select one of the options:
Ribbon Menu |
Name |
Shortcut Menu |
Description |
 |
Size to Fit |
To Fit |
The controls will be resized based on the
contents of their value |
 |
Size to Grid |
To Grid |
The controls will be resized so their borders
fit with the grid lines |
 |
Size to Tallest |
To Tallest |
The heights of the selected controls will be
increased to match the height of the tallest control |
 |
Size to Widest |
To Widest |
The widths of the selected controls will be
increased to match the width of the widest control |
 |
Size to Shortest |
To Shortest |
The heights of the selected controls will be
decreased to match the height of the shortest control |
 |
Size to Narrowest |
To Narrowest |
The widths of the selected controls will be
decreased to match the width of the narrowest control |
Practical
Learning: Resizing Various Controls
|
|
- On the form, position the mouse inside the horizontal ruler at 1/2
and click to select the labels
- On the Ribbon, click Arrange if necessary.
In the Sizing and
Ordering section, click Size/Space and click To Widest

- Save the form
The Width and the Height Properties of a Control
|
|
You can also resize a control or a group of controls
using the Properties window. In the Properties window, the width of a
control is represented by the Width property while the height of a
control is represented by the Height field. Therefore, to resize a
control with more precision, you can change either or both its Width
and/or its Height properties. To resize a group of controls, first
select them. In the Properties window, change either or both the values of
the Width and/or the Height fields.
|
|
No comments:
Post a Comment