Показать сообщение отдельно
  #2  
Старый 06.10.2011, 08:29
Аватар для NumLock
NumLock NumLock вне форума
Let Me Show You
 
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
По умолчанию

Цитата:
WM_CTLCOLOREDIT
By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the edit control.
Код:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    ABrush: HBRUSH;
    AWnd: HWND;
    procedure WMCTLCOLOREDIT(var Msg: TMessage); message WM_CTLCOLOREDIT;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  ABrush:=CreateSolidBrush($ff0000);
  AWnd:=CreateWindowEx(WS_EX_CLIENTEDGE,
  'EDIT',
  'null',
  WS_CHILD or WS_VISIBLE,
  10, 10, 100, 50,
  Handle, 0, HInstance, nil
  );
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  DestroyWindow(AWnd);
  DeleteObject(ABrush);
end;

procedure TForm1.WMCTLCOLOREDIT(var Msg: TMessage);
begin
  if HWND(Msg.LParam)=AWnd then
  begin
    Msg.Result:=ABrush;
    SetTextColor(Msg.WParam, $ffff);
    SetBkMode(Msg.WParam, TRANSPARENT);
  end else inherited;
end;

end.
__________________
Пишу программы за еду.
__________________
Ответить с цитированием