8 skills in Delphi

xiaoxiao2021-03-06  38

Delphi's 8 tricks ------------------------------------------------------------------------- ---------------------------------- Zhang Tao 2003-6-28 Source: Snone Studio

1. How Delphi calls external EXE files?

Uses WinProcs; Begin Winexec (...);

End. and call the pascal library function. 2. Delphi Hint's font and color how to change the property of Tapplication in Delphi has HintColor and Hintpause. You can change the Hint time by setting HintColor to change the color of the Hint PaSE to change the HINT. But unfortunately: Hint's font in Delphi cannot be changed. 3. How to calculate the date in Delphi

The time is the easiest in Delphi, as follows:

Var SS: TDATETIME

In fact, TDATETIME is a double-precision floating point number, which indicates the number of days before the decimal point:

For example, ss: = ss 20 indicates that the start from SS is 20 days, if SS = 234.567 It represents 234.567 days, of course, it is calculated from the 0 year of AD! 4. How to use the Delphi Screensaver? (NULL) screen saver is nothing more than the extension. Scr, the executable, which accepts two command line parameters: -s Run command parameter -c configuration command parameter windows By order Send -s command line parameters to launch the program. It should be noted that the window of the program is boundless and heading; the window size should be the same as the screen size; also pay attention to the processing of the event of the window. 5. How to change the name of the directory in Delphi

Call the renamefile function, such as:

Renamefile ('c: / wang / temp', 'c: / wang / tmp "; 6. Delphi Display JPEG image file

As long as you join JPEG in Use, there is a TJPEGIMAGE class in the JPEG unit, you can define a variable such as JPEG, tune a JPEG file with LoadFromFile, and then use Form's Canvas.DRAW (X, Y, JPEG) to display. 7 Delphi processing of JPEG format files ... (1). Join the JPEG unit in UseS; (2). Define a full variable, such as VAR Ajpeg: TjpegImage; (3). Add:

Canvas.pen.color: = CLBLACK; canvas.pen.style :=pssolid; canvas.brush.color: = CLBTNFACE; canvas.brush.style :=Bssolid; // This is some properties of Canvas, which is convenient / / CLEAR FORM AND LOAD A New Jpeg File; Ajpeg: = TjpegImage.create; // Dynamically generates ajpeg; ajpeg.loadFromfile ('D: /TEMP.JPG') // After generating AJPEG, transfer to a JPEG file;

(4). Join in the ONPAIN event of Form

Canvas.Rectangle (2, 2, 560, 430); // Draw a rectangle of a black box to enclose the picture; x: = 10; y: = 10; Form1.canvas.Draw (x, y, ajpeg); // Y) The JPEG file is output in the upper left corner; // actually its role is that the graphic is destroyed to restore graphics;

(5) Add: begin if OpenPictureDialog1.execute1 begin ajpeg.free; // Release the old Ajpeg; ajpeg: = tjpegimage.create; // Generate a new AJPEG Ajpeg.LoadFromFile (OpenPictureDialog1.FileName); // Load JPEG file; End; Canvas.Rectangle (2, 2, 560, 430); // Put Form Clear; x: = 10; Y: = 10; Form1.canvas.DRAW X, Y, AJPEG); // Displays new Ajpeg; end; 8. Delphi3 launch screen in Your * .dbr Files do it begin {create a splash form} Splash: = tsplash.create (self); splash.show; Splash.Update Application.initialize; Application.createform (..)........................................ ..

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

New Post(0)