Mirror

How can I find out / set the backgroundcolor of the site in TWebbrowser? (Views: 100)


Problem/Question/Abstract:

How can I find out / set the backgroundcolor of the site in TWebbrowser?

Answer:

//You need a TWebbrowser and 3 TButtons

// First load a page

procedure TForm1.Button1Click(Sender: TObject);
begin
  WebBrowser1.Navigate('http://dkb.kastu.lt');
end;

// Show the background color

procedure TForm1.Button2Click(Sender: TObject);
begin
  ShowMessage(WebBrowser1.OleObject.Document.bgColor);
end;

// Set the background color

procedure TForm1.Button3Click(Sender: TObject);
begin
  WebBrowser1.OleObject.Document.bgColor := '#000000';
end;

<< Back to main page