透明输入框

 

Code

 procedure HandleCTLColorEdit(var Msg: TWMCTLCOLOREDIT);message WM_CTLCOLOREDIT;

procedure TForm1.Button2Click(Sender: TObject);
var
  BMP: TBitmap;
begin
  BMP := TBitmap.Create;
  BMP.LoadFromFile('C:\Documents and Settings\Administrator\桌面\未命名.bmp');
  Memo1.Brush.Bitmap := BMP;
  Memo1.Repaint;
  Bmp.Free;
end;

procedure TForm1.HandleCTLColorEdit(var Msg: TWMCTLCOLOREDIT);
begin
  if Msg.ChildWnd = Memo1.Handle then begin
    SetBkMode(Msg.ChildDC, TRANSPARENT);
    Msg.Result := Memo1.Brush.Handle;
  end;

end;

posted @ 2009-05-14 21:59  谭志宇  阅读(1037)  评论(0编辑  收藏  举报