Ver Mensaje Individual
  #2  
Antiguo 18-10-2015
Avatar de MAXIUM
MAXIUM MAXIUM is offline
Miembro
 
Registrado: may 2005
Posts: 1.490
Reputación: 21
MAXIUM Va camino a la fama
Actualización
========

Hasta el momento he conseguido un bonito rectángulo con el color del borde a gusto. Voy avanzando

Código Delphi [-]
unit GroupBoxEX;

interface

uses
  SysUtils, Classes, Controls, StdCtrls, Graphics;

type
  TGroupBoxEX = class(TGroupBox)
  private
    { Private declarations }
    FBorderColor: TColor;
    procedure SetBorderColor(Value:TColor);
  protected
    { Protected declarations }
    procedure Paint; override;
  public
    { Public declarations }
    constructor Create(AOwner:TComponent); override;
  published
    { Published declarations }
    property BorderColor: TColor read FBorderColor Write SetBorderColor Default clBlack;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Personales', [TGroupBoxEX]);
end;

constructor TGroupBoxEX.Create(AOwner:TComponent);
begin
     inherited;
     FBorderColor:= clBlack;
end;

procedure TGroupBoxEX.SetBorderColor(Value:TColor);
begin
     If FBorderColor <> Value Then
     Begin
          FBorderColor:= Value;
          Invalidate;
     End;
end;

procedure TGroupBoxEX.Paint;
var
   X, Y, W, H: Integer;
begin
     With Canvas Do
     Begin

       // Pluma
          Pen.Width:= 1;
          Pen.Color:= BorderColor;

       // Brocha
          Brush.Color:= Color;
          Brush.Style:= bsSolid; //Relleno Sólido

          X:= Pen.Width div 2;
          Y:= X;
          W:= Width - Pen.Width + 1;
          H:= Height - Pen.Width + 1;

          FillRect(ClientRect);
         
          Brush.Style:= bsClear; //Relleno Sólido

          Rectangle(X, Y, X + W, Y + H);
     End;
End;

end.
Responder Con Cita