<SNIP>
> This could also be used to override the painting of the non-client area for
> repainting of the border by adding a WM_NCPAINT handler,
>       procedure WMNCPaint(var Message: TMessage); message WM_NCPAINT;
> Not sure what it is exactly you want to do and I do not have Manifest
> installed
> so I can't test this for you.

Give this a try and manipulate the color to do what you want:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TEdit = class(StdCtrls.TEdit)
  private
    procedure WMNCPAINT(var Msg: TMessage); message WM_NCPAINT;
    procedure SetControlBorder(ARect: TRect);
  end;

  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

{ TEdit }

procedure TEdit.SetControlBorder(ARect: TRect);
var
  LCanvas:                     TCanvas;
begin
  LCanvas := TCanvas.Create;
  try
    LCanvas.Handle := GetWindowDC( Handle );
    LCanvas.Pen.Style := psSolid;
    LCanvas.Pen.Color := clInactiveBorder;
    LCanvas.Brush.Style := bsClear;
    LCanvas.Rectangle( 0, 0, Width, Height );
    LCanvas.Rectangle( 1, 1, Width - 1, Height - 1 );
  finally
    ReleaseDC( Handle, LCanvas.Handle );
    LCanvas.Free;
  end;
end;

procedure TEdit.WMNCPAINT(var Msg: TMessage);
var
  DC: HDC;
  RC: TRect;
  oldRC: TRect;
begin
  if not Enabled then
  begin
    DC := GetWindowDC(Handle);
    try
      Windows.GetClientRect(Handle, RC);
      oldRC := RC;
      InflateRect(RC, 4, 4);
      Brush.Color := clBtnFace;
      Windows.FillRect(DC, RC, Brush.Handle);
      SetControlBorder(RC);
    finally
      ReleaseDC(Handle, DC);
    end;
  end
  else
  begin
    inherited;
  end;
end;

end.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk

Reply via email to