zoukankan      html  css  js  c++  java
  • delphi TEdit透明

    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:ack1.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.

  • 相关阅读:
    Python之路Day02
    Python之路Day01
    Python 常用单词
    JS-向数组添加元素
    JS-lambda表达式
    正则表达式问记录
    JDBC学习
    jquery常用选择器
    mongodb学习
    java8 lambda表达式
  • 原文地址:https://www.cnblogs.com/yzryc/p/6329411.html
Copyright © 2011-2022 走看看