全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1425
推到 Plurk!
推到 Facebook!

請問有辦法做透明的文字輸入方塊嗎

答題得分者是:william
elase
一般會員


發表:4
回覆:23
積分:10
註冊:2003-06-05

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-08-11 15:43:47 IP:61.219.xxx.xxx 未訂閱
在文字輸入方塊下有一個圖片 希望圖片能夠顯示出來
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-08-11 15:54:01 IP:147.8.xxx.xxx 未訂閱
elase
一般會員


發表:4
回覆:23
積分:10
註冊:2003-06-05

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-08-12 10:11:23 IP:61.219.xxx.xxx 未訂閱
謝謝已改成我要的功能 不過執行的時候 畫面會有閃動的問題 請問是否有方法可以解決
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-08-12 10:27:32 IP:147.8.xxx.xxx 未訂閱
引言: 謝謝已改成我要的功能 不過執行的時候 畫面會有閃動的問題 請問是否有方法可以解決
Flcikering? when? If it flickers during scrolling, then it is normal... It would be a huge modification (not worth the effort) to remove flickering in this case.
elase
一般會員


發表:4
回覆:23
積分:10
註冊:2003-06-05

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-08-12 18:22:26 IP:61.219.xxx.xxx 未訂閱
我用的是 TEdit 所以不會有 scroll 的事件發生 可是在 Keyin 的時候就會出現閃動    附上程式碼
 
unit MYEdit;    interface    uses
  SysUtils, Classes, Controls, StdCtrls, Messages, Windows, Forms;    type
  TMYEdit = class(TEdit)
  private
    { Private declarations }
    procedure CNCTLCOLOREDIT(var Message: TWMCTLCOLOREDIT); message CN_CTLCOLOREDIT;
    procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND;
    procedure WMKeyDown(var Message: TWMKeyDown); message WM_KEYDOWN;
  protected
    { Protected declarations }
  public
    { Public declarations }
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
  published
    { Published declarations }
  end;    procedure Register;    implementation    procedure Register;
begin
  RegisterComponents('MY Editer', [TMYEdit]);
end;    { TMYEdit }    procedure TMYEdit.CNCTLCOLOREDIT(var Message: TWMCTLCOLOREDIT);
begin
    with Message do begin
        SetBkMode(ChildDC,TRANSPARENT);
        Result := GetStockObject(HOLLOW_BRUSH);
    end;
end;    constructor TMYEdit.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  Parent := (AOwner as TWinControl);
  self.BorderStyle:=bsNone;
  SetWindowLong(Handle,GWL_EXSTYLE,GetWindowLong(Handle,GWL_EXSTYLE)
                or WS_EX_TRANSPARENT);
end;    destructor TMYEdit.Destroy;
begin      inherited Destroy;
end;    procedure TMYEdit.WMEraseBkgnd(var Message: TWMEraseBkgnd);
var
  ARect: TRect;
begin
  ARect := ClientRect;
  with ARect do begin
       TopLeft     := Parent.ScreenToClient(ClientToScreen(TopLeft));
       BottomRight := Parent.ScreenToClient(ClientToScreen(BottomRight));
  end;
  InvalidateRect(Parent.Handle,@ARect,True);
  RedrawWindow(Handle,nil,0,RDW_FRAME or RDW_INVALIDATE);
  Message.Result := 1;
end;    procedure TMYEdit.WMKeyDown(var Message: TWMKeyDown);
begin
  inherited;
  Invalidate;
end;    end.
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#6 引用回覆 回覆 發表時間:2003-08-14 11:07:55 IP:147.8.xxx.xxx 未訂閱
Did it work in your machine? On mine (XP Pro SP1), it won't work unless I make it a multi line control, e.g.
  TMYEdit = class(TEdit)
  private
    { Private declarations }
    procedure CNCTLCOLOREDIT(var Message: TWMCTLCOLOREDIT); message CN_CTLCOLOREDIT;
    procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND;
    procedure WMKeyDown(var Message: TWMKeyDown); message WM_KEYDOWN;
  protected
    { Protected declarations }
    procedure CreateParams(var Params: TCreateParams); override;
  public
    { Public declarations }
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
  published
    { Published declarations }
  end;
.....
procedure TMYEdit.CreateParams(var Params: TCreateParams);
begin
    inherited;
    Params.Style := Params.Style or ES_MULTILINE;
end;
....
But then you may need to filter out the return key... WM_CHAR is a good place instead of WM_KEYDOWN >
elase
一般會員


發表:4
回覆:23
積分:10
註冊:2003-06-05

發送簡訊給我
#7 引用回覆 回覆 發表時間:2003-08-15 16:05:36 IP:61.219.xxx.xxx 未訂閱
Windows2000 Professional Delphi 7
系統時間:2024-05-10 6:50:37
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!