Cool !!! Delphi graphic editing skills two

zhaozj2021-02-11  219

First, the realization of interface color gradient effect

The interface color gradient effect is achieved by sequentially adjacent rectangular blocks by a gradient brush brush. Example of the example below:

1. Create a new form, assume that its width is 500, set a button button1, press this button to put the table as the gradient effect of the yellow-backed white.

The code of the 2.button1 button is as follows:

Procedure TFORM1.BUTTON1CLICK (Sender: TOBJECT);

Var i, J: integer;

DCT: TRECT;

Begin

J: = form1.height;

// Get the height of the form

For i: = 0 to 255 do

// Set a color value in RGB () here

Begin

Canvas.brush.color: = RGB (255, 255, i);

/ / Draw a rectangular painting color each time

DCT: = RECT (i * 2, 0, (i 1) * 2, j);

// Rectangular area each time you brush

Canvas.FillRect (DCT);

// Pack color

END;

END;

Second, the graphic is overall

A simple graphic overall tensile effect is relatively simple, dynamically change the size of the graphics area, but the graphic "Stretch" should be set to "True" in advance.

For example, the pull-down effect:

1. Place a picture on the form, the height is 200, the property "Height" is set to 0, "Stretch" is set to True. Add the "Timer" component, "interval" is set to 200, "enable" is set to TURE.

2. Add code to Timer1Timer:

Procedure TFORM1.TIMER1TIMER (Sender: TOBJECT);

Begin

Image1.height: = image1.Height 20;

// Set increment

IF image1.height = 200 Timer1.enabled: = false;

/ / The graph is completely pulled out.

END;

The above two cases run in Windows95, Delphi3.0 environment

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

New Post(0)