Delphi Skills Four

zhaozj2021-02-11  215

First, custom Speedbar

In the visual design interface of Delphi, the most frequently located is located in the acceleration button bar (Speedbar) in the upper left corner of the screen. In practice, the author unintentionally discovered the custom method of SpeedBar, which did not mention it in the four Delphi reference books I have. Proceed as follows:

Right click on SpeedBar, select Properties in the pop-up menu, and a dialog named SpeedBareditor will appear. Suppose you want to add a "syntax check" feature, you can select Project in the Categories list box on the left, then drag and drop the Syntax Check icon on the right, this feature has been added. If there is no extra space on the spetedbar to accommodate the new button, stop the mouse to the right box of Speedbar, turn the right distance to the right, and drag to the right to take a space. If you want to delete a button on the SpeedBar, you can simply drag it out of the speedbar range and you can delete it. It is very convenient to operate. It is recommended to add Syntax Check, Project Options, WindowsAPI Help to Speedbar, which can increase development efficiency.

Second, shortcuts when designing Form

Use shortcuts to speed up design speed. The shortcuts listed below can be skilled in order to master according to the actual situation.

Del: Delete the selected component;

ESC: Select the container of the current component (usually Panel, Group or FORM);

F11: Switch between Form or Unit and object inspections;

F12: Switch between Form and code editing device;

Ctrl F12: Displays the "View Unit" dialog;

Shift F12: Displays the "View Form" dialog;

Tab: Next component;

SHIFT TAB: Previous component;

Direction Key: Select the nearest components in this direction;

Ctrl arrow keys: Move the selected component a point;

Shift arrow keys: Change the selected component to the size of a point;

Ctrl Shift arrow keys: move the selected component;

Shift Click: Press and hold the Shift key and click the component with the mouse to select multiple components.

Below this is what I explored:

Ctrl DRAG: Press and hold the Ctrl key to drag the mouse in a container component (such as Panel, QReport, GroupBox, etc.), forcing all the visual components that belong to this container in the rectangular box (not included) .

Third, the use of command line parameters

Delphi provides a convenient way to access the command line parameters, that is, using the paramstr and paramcount functions. Where paramstr (0) returns the current program name, such as C: TestmyProg.exe, Paramstr (1) Returns the first parameter, with this class; paramcount is the number of parameters. Examples are as follows:

VAR

I: word;

Y: integer;

Begin

Y: = 10;

For i: = 1 to Paramcount Do Begin

Canvas.TextOut (5, Y, Paramstr (i));

Y: = y canvas.textheight (paramstr (i)) 5;

END;

END;

Fourth, DCU file (compiled library unit) reuse

(1) Quote in the USES clause in the interface. Such as Windows, Dialogs, etc., requiring the quoted DCU must be placed in the Delphi 3Lib subdirectory. (2) Quote in the USES clause in the Implementation. If it is a DCU file written by yourself, this method should be used and the referenced DCU file is placed in the subdirectory where the current project is located.

转载请注明原文地址:https://www.9cbs.com/read-4064.html

New Post(0)