Delphi Form Designer 3

Source: Internet
Author: User
Prevents components from being moved or changed

Components can be locked so that they cannot be moved. It is useful to lock components, so that you know that Form Designer has finished its work and you do not want to worry about accidentally moving controls. To lock the Form Control, select 【Edit | lock controls]. Locked controls cannot be moved or changed. When controls are locked, their size change handles are gray and black edges. For example, button1, button2, and button3 are locked:

To unlock the control, select 【Edit | lock controlsThe widget can be moved as before. With this technology, you can lock all components on the form or one of them, but cannot lock the selected components.

 

Sort, cut, copy and paste Components

Sometimes the component is placed on the other to produce a visual effect. For example, placing the white box on the black box will produce a shadow box. Obviously, the Shadow cannot be placed on the box, so you have to sort the control to tell Delphi which controls are put on and which ones are put below. Now let's make a simple connection and also explain how to use the copy and paste components. Start the empty form first, and then perform the following steps:

1. ClickAdditionaL tag, selectShapeComponent, click the button on the form to setShape, The white square appears on the form;

2. Set the shape size as expected, as shown below:

3. Make sure that the shape component is selected. Select 【Edit | copy];

4. Select 【Edit | Paste]. The copy of a shape is placed in the lower right of the original shape. It is really convenient, as shown below:

Note

After the paste operation, the pasted component is selected.

1. Double-clickBrushAttribute to change its color attributeClblackThe new shape is black, but on the original shape, we need to adjust some order;

2. Right-click and select 【Control | send to back]. The black shape moves to the back of the white shape, and now there is a shadow box.

This exercise illustrates two features of Form Designer,Shows how to change the stacking order of controls,How to copy components with copy and paste.

The attributes of the original component are correctly copied and pasted as the paste processing part. Each time you paste a component, it is placed at the bottom right of the original component.

Note

When pasting, if the component used as the container has been selected, the component in the clipboard will be pasted in this container component. For example, if you want to move the button from the main window to the Panel, select the button and select the shortcut menu 【Edit | cut] Cut the button from the form and place it in the clipboard. Then select panel and select 【Edit | Paste] Paste the button into the panel.

Tip

You can also copy the component and paste it in code editor. For example, after copying an edit component and pasting it, the result is as follows:

object Edit1: TEdit  Left = 180  Top = 110  Width = 121  Height = 21  TabOrder = 0  Text = 'Edit1'end

This is not to edit the code, but it provides the size and position of the edit component on the form. This information is useful when a component is created in the running phase rather than in the design phase. Put the component visually on the form, use copy and paste to obtain its size and position information, and then delete the component, therefore, you can write code to correctly create components with proper size and position in the running stage.

 

Set component size

For some components, place them on the form and accept the default size. Button is a good example. Standard buttons are 25 pixels in height and 75 pixels in width. For example:

In many cases, the default button size is exactly what you want. However, for some components, the default size is very small. For example, for memo components, you almost always need to set the size to fit the specific form.

1. Set the size by dragging

When the control is selected, the eight black handles appear around the control. When you place the mouse on any of the handles, the cursor turns into a double arrow, known as the size setting cursor. When you see the size setting indicator, start to drag to set the control size. How to set the component size depends on the Size Control handle.

Set the vertical size for the size handle in the center of the upper and lower sides of the component, and set the horizontal size of the component for the same left and right size handle. If you grasp the size handle on the component angle, you can set the horizontal and vertical size of the component. When the size handle is expected to be larger, release the mouse button and reset the widget size. The following figure shows how to set the size of the memo component:

Figure 1. Setting the memo component size

Figure 2. Set the form size

Note

The size setting value is used for visualization components. Non-visual components appear on the form as icons and cannot be set in size. The size handle appears on a non-visualized component. You can drag it and the drag result is ignored.

You cannot drag a control group to set its size. When more than one component is selected, the size handle is replaced by a selection prompt.

 

Tip

You need to set all components in the group in sequence, change the width and height attributes in the object inspector, or use the size dialog box to set.

 

Tip

To set the size of a control or control group one pixel at a time, you must press the Shift key and press any arrow to control its vertical and horizontal size. Only the width and height attributes of the component are affected, while the left and top attributes remain unchanged.

2. Use the size dialog box to set the size.

Another way to set the size is the size dialog box. You can select 【Position | size...Or from the main menu 【Edit | size...] Open the size dialog box, such:

To make a group of controls have the same height or width, use the size dialog box. For example, the form has six edit components with different widths. To make the form look more neat, you need to make them the same width. Select the six components first, then bring up the size dialog box, and select"Shrink to smallest"To set the width of all components according to the minimum width, or select"Grow to largest"To set the width of all components to the maximum width, or you canWidth edit boxEnter the exact width. In this case, make sure that"No change". Click OK. The component has the same width.

3. Set the size in the scale dialog box.

Another tool used to set the size is the scale dialog box. Select 【Edit | scale...Or select 【Position | scale...] Call up the scale dialog box. For example:

This dialog box specifies the percentage. To create a component that doubles the size, enter 200 in the scale edit box. To reduce the size by half, enter 50. The scale dialog box is very convenient to quickly change the size of All Form components.

Note

Remember, you can change the left and top attributes in the object inspector to move the component. You can change the width and height attributes to set the size of the component.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.