Cita:
Empezado por eduarcol
Debido que este componente no tiene el evento onPaint lo cambie por el TControlBar
|
Amigo, eso es un
kludge
En lugar de cambiar el panel por un ControlBar, podrías redefinir el método Paint del panel o bien insertarle un PaintBox. Aquí un ejemplito:
Código Delphi
[-]
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, ExtCtrls;
type
TForm1 = class(TForm)
Panel1: TPanel;
PaintBox1: TPaintBox;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
procedure PaintBox1Paint(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
type
TTriVertex = record
X, Y: LongInt;
Red: Word;
Green: Word;
Blue: Word;
Alpha: Word;
end;
function GradientFill(
DC: HDC; var Vertex: TTriVertex; NumVertex: ULONG; Mesh: Pointer; NumMesh,
Mode: ULONG): BOOL; stdcall; external msimg32;
procedure GradientRect(DC: HDC; R: TRect; Color1, Color2: TColor);
var
Vertices: array[0..1] of TTriVertex;
Rect: TGradientRect;
Color: Integer;
begin
Color := ColorToRgb(Color1);
Vertices[0].X := R.Left;
Vertices[0].Y := R.Top;
Vertices[0].Red := $100*GetRValue(Color);
Vertices[0].Green := $100*GetGValue(Color);
Vertices[0].Blue := $100*GetBValue(Color);
Vertices[0].Alpha := 0;
Color := ColorToRgb(Color2);
Vertices[1].X := R.Right;
Vertices[1].Y := R.Bottom;
Vertices[1].Red := $100*GetRValue(Color);
Vertices[1].Green := $100*GetGValue(Color);
Vertices[1].Blue := $100*GetBValue(Color);
Vertices[1].Alpha := 0;
Rect.UpperLeft := 0;
Rect.LowerRight := 1;
GradientFill(DC, Vertices[0], 2, @Rect, 1, GRADIENT_FILL_RECT_H);
end;
procedure TForm1.PaintBox1Paint(Sender: TObject);
begin
Paintbox1.Canvas.Brush.Color := clNavy;
GradientRect(Paintbox1.Canvas.Handle, Paintbox1.ClientRect, clWhite, clNavy);
end;
end.
// Saludos