Delphi menyediakan fungsi untuk bermain dengan warna-warna. Salah satunya adalah gradasi warna, seperti yang anda lihat pada gambar.
unit UMain; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm3 = class(TForm) procedure FormPaint(Sender: TObject); procedure FormResize(Sender: TObject); private { Private declarations } public { Public declarations } end; type _TRIVERTEX = packed record x: DWORD; y: DWORD; Red: Word; Green: Word; Blue: Word; Alpha: Word; end; var Form3: TForm3; implementation function GradientFill(Handle: HDC; pVertex: Pointer; dwNumVertex: DWORD; pMesh: Pointer; dwNumMesh: DWORD; dwMode: DWORD): DWORD; stdcall; External 'msimg32.dll'; {$R *.dfm} procedure TForm3.FormPaint(Sender: TObject); var udtVertex: Array [0..1] of _TRIVERTEX; RectGradient: TGradientRect; begin with udtVertex[0] do begin x:= 0; y:= 0; Red:= 0; Green:= 0; Blue:= 0; Alpha:= 0; end; with udtVertex[1] do begin x:= Width; y:= 70; Red:= $FF00; Green:= $FF00; Blue:= $FF00; Alpha:= $0000; end; RectGradient.UpperLeft:= 0; RectGradient.LowerRight:= 1; GradientFill(Canvas.Handle, @udtVertex, 2, @RectGradient, 1, GRADIENT_FILL_RECT_H); end; procedure TForm3.FormResize(Sender: TObject); begin Repaint; end; end.
Untuk cara alternatif membuat efek gradasi warna di delphi, baca juga Cara Membuat Efek Gradasi Warna Pada Form Delphi (Bagian 2)
Lucky Club Casino Site - A FREE SPINS Bonus for Every Player
ReplyDeleteLucky Club Casino. Bonus. 100% match bonus. 50 free spins to use on any of the 1,000+ slots games. Deposit a total of 25 (5) and luckyclub.live receive the bonus