Programming Delphi How to change the colors of the TWebBrowser scrollbar?
Notice: Undefined variable: relatedArticlesCount in /home/wwwroot/codeback.net/plugins/content/tags.php on line 149

Create a new project in Delphi, then put a WebBrowser and two buttons to the form. Double click the form, in the formcrate procedure add the navigate codes. Then double click the button1 and button2, assign proper codes in its onclick handler.

procedure TForm1.FormCreate(Sender: TObject);
begin
  WebBrowser1.Navigate("codeback.net");
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  with WebBrowser1 do
  begin
    OleObject.document.body.Style.scrollbarFaceColor := '#FF6699';
    OleObject.Document.body.Style.scrollbarTrackColor := '#CCCC99';
    OleObject.document.body.Style.scrollbarHighlightColor := '#99FF99';
    OleObject.document.body.Style.scrollbar3DLightColor := '#6699CC';   
    OleObject.Document.body.Style.scrollbarShadowColor := '#6600FF';
    OleObject.document.body.Style.scrollbarDarkShadowColor := '#00CC66';   
    OleObject.document.body.Style.scrollbarArrowColor := '#336699';
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  WebBrowser1.OleObject.Document.Body.Style.OverflowX := 'hidden';
  WebBrowser1.OleObject.Document.Body.Style.OverflowY := 'hidden';
end;

Run the program, click button1 and button2, see what happen.

You may be interesting in the following articles:
how to capture a webpages content and save it to an image
how-to-use-twebbrowser-to-load-a-document-from-memoryfrom-a-string
How to get the inner html source of a selected object in a TWebbrowser?
how-to-add-alternative-text-to-an-image-in-twebbrowser-in-delphi
How to add alternative text to an image in TWebBrowser in Delphi
how-to-open-a-new-web-page-in-your-custom-window-with-twebbrowser-in-delphi
How to use TWebBrowser to load a document from memory(from a string)?
hot-to-get-the-image-properties-in-twebbrowser-in-delphi
how-to-make-twebbrowser-get-focus-in-delphi
use-the-twebbrowser-as-a-html-editor-in-delphi
how-to-get-a-webpages-html-source-by-using-twebbrowser-component-in-delphi


Add comment


Security code
Refresh

Programming - Delphi