小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

Transparent TCustomcontrol

 quasiceo 2013-05-03
 
  #2  
Old 11-21-2002, 03:31 AM
Senior Member
 
Join Date: Apr 2001
Posts: 2,182
Default RE: Transparent TCustomcontrol

Transparent TCustomcontrol
hi to all,

I have a problems with making a TCustomcontrol transparent.
I added:

Procedure CreateParams(var Params: TCreateParams); override;

implenmentation

procedure TDSPTransparentPanel.CreateParams(var Params: TCreateParams);
begin
{ call the create of the params }
inherited CreateParams(Params);
Params.ExStyle := Params.ExStyle + WS_EX_Transparent;
ControlStyle := ControlStyle - [csOpaque] + [csAcceptsControls]
end;


This makes the Component transparent, but when I place an
Imagebox on it and I'am moveing the Imagebox per runtime,
the background of the TCustomcontrol losess it's
tranzparency . When I minimize and maximize the Form or when I move an other Window over it (e.g. explorer) , the transparency will be back.

So here is my Question:
What must I do to get this effect by code, to get the transparency back?
I called self.redraw , self.invalidate but without effect.


Please help me solve this Problem
Best Regards
BT
Try this:


Override its CreateParam method like this:

private // in control declaration
Procedure CreateParams( Var params: TCreateParams ); override;

Procedure TTransparentXXX.CreateParams( Var params: TCreateParams );
begin
inherited CreateParams( params );
params.ExStyle := params.ExStyle or WS_EX_TRANSPARENT;
end;

Add a handler for the WM_ERASEBKGND message:

Procedure WMEraseBkGnd( Var msg: TWMEraseBkGnd );
message WM_ERASEBKGND;

Procedure TTransparentXXX.WMEraseBkGnd( Var msg: TWMEraseBkGnd );
begin
SetBkMode( msg.DC, TRANSPARENT );
msg.result := 1;
end;

That is the basic frame for a TWinControl descendent. For a
TGraphicsControl you would drop the CreateParams (since only
WinControls have that method) and override the create constructor.
After calling the inherited constructor you modify the ControlStyle of
the control:

ControlStyle := ControlStyle - [csOpaque];

Transparency actually works better for TGraphicControls than for
TWinControls. The latter have problems if the control is moved or the
background needs to change. Delphi container controls (like form or
panel) are always created with the WS_CLIPCHILDREN style, which
automatically excludes the area under child controls from updates, so
the background will not be updated if required. Removing the
WS_CLIPCHILDREN style from a controls parent is possible with

SetWindowLong( parent.handle, GWL_STYLE,
GetWIndowLong( parent.handle, GWL_STYLE )
and not WS_CLIPCHILDREN );



Greetz,
::TeD On The NeT::

=[ QUESTIONS ]=========================================
please click Accept as Answer if my reply helped you.

=[ EXTRA INFO ]========================================
Location : Netherlands (GMT +01.00)
Languages : English, Dutch, German
Age : 25
ICQ : Be smart and figure out what my UIN is...
-------------------------------------------------------
Used OS : Win2k SR2 | Win2k SR3
Delphi # : Enterprise 5 SP2 | Enterprise 6 SP2
================================================== =====
Reply With Quote
  #3  
Old 11-21-2002, 06:07 AM
Member
 
Join Date: Nov 2001
Posts: 55
Default Transparent TCustomcontrol

I added a TImage to the create proedure in my
Transparent Component (TCustumcontrol) Create procedure:


Ibar := TImage.create(self);
Ibar.parent := self;
SetWindowLong(Ibar.parent.handle, GWL_STYLE,
GetWIndowLong(Ibar.parent.handle, GWL_STYLE )
and not WS_CLIPCHILDREN );


but when I move the Ibar per runtime the background of my Component will not updated. What can be wrong?


Please Help
Best Regards
BT
Reply With Quote
Ibar.parent := self.parent可以解決!;

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多