首页 > Windows开发 > 详细

delphi TEdit透明

时间:2017-01-20 23:08:26      阅读:602      评论:0      收藏:0      [点我收藏+]

unit Unit1;

interface

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

type

TForm1 = class(TForm)

edt1: TEdit;

procedure FormCreate(Sender: TObject);

private

fbmp: TBitmap;

fbsh: HBRUSH;

protected procedure WndProc(var Messages: TMessage); override;

public { Public declarations }

end;

var Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);

begin

fbmp := TBitmap.Create;

fbmp.LoadFromFile(‘c:\back1.bmp‘);

fbsh := CreatePatternBrush(fbmp.Handle);

end;

procedure TForm1.WndProc(var Messages: TMessage);

begin

inherited;

case Messages.Msg of

WM_CTLCOLOREDIT, WM_CTLCOLORSTATIC:

if (Messages.LParam=edt1.Handle) and(fbsh <> 0) then

begin

SetBkMode(Messages.WParam, TRANSPARENT);

Messages.Result := fbsh

end;

end;

end;

end.

delphi TEdit透明

原文:http://www.cnblogs.com/yzryc/p/6329411.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!