Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make a transparent TWebBrowser?

Status
Not open for further replies.

zyzjacky

Programmer
Jan 19, 2006
76
MT
Hi,
I am wondering if it's possible to make the TWebBrowser's background transparent? which it will only display the html content and nothing else. That would be very interesting, don't you think ?Thanks!
 
Not if you use color black as your desktop background.
Even if your background color is red, all red text would be invisible. Sounds like nuisance to me.


Roo
Delphi Rules!
 
After further review, I made an interesting discovery. IF you have an nVidia graphics card and have installed the nVidia Control Panel, you can right-click on any window and select "Make Window Transparent". To my surprise, transparent windows are not actually transparent, they are translucent.

So, if this was the effect zyzjacky was looking for, my first responce does not apply.

Roo
Delphi Rules!
 
hi roo0047, that is an interesting one! but not exactly what i am looking for.
i have found a way to draw a bmp as the background, anyone of you can advice me to draw a png instead of bmp, or a transparent bmp? not using the transparent color, otherwise that area in the form would be invisible.

here is the code
procedure TformMain.FormShow(Sender: TObject);
begin
OldMessage:=WebBrowserMainFrame.WindowProc;
WebBrowserMainFrame.WindowProc:=OleMessage;
end;

procedure TformMain.OleMessage(var Msg: TMessage);
var
c:TCanvas;
bmpBG:TBitmap;
begin
OldMessage(Msg);
if Msg.Msg=WM_PAINT then
begin
bmpBG := TBitmap.Create;
//bmpBG.LoadFromFile(strCurrentDir+'\1.bmp');
c:=TControlCanvas.Create;
TControlCanvas(c).Control:=WebBrowser1;
c.Brush.Style:=bsClear;
c.StretchDraw(c.ClipRect,bmpBG);
end;
end;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top