ich versuche mich aktuall am twebbrowser.
angeblich kann man die scrollbars ausblenden.
ich nutze folgenden code:
Delphi-Quellcode:
unit MyWebBrowser;
interface
uses
SHDocVW,
MSHTML;
type
TMyWebBrowser =
class(TWebBrowser)
strict private
private
FShowScrollbars: Boolean;
function GetActualDocument(): IHTMLDocument2;
procedure SetShowScrollBars(
const Value: Boolean);
published
public
published
property ActualDocument: IHTMLDocument2
read GetActualDocument;
property ShowScrollBars: Boolean
read FShowScrollbars
write SetShowScrollBars;
end;
procedure Register();
implementation
procedure Register();
begin
RegisterComponents('
Tests', [TMyWebBrowser]);
end;
{ TMyWebBrowser }
function TMyWebBrowser.GetActualDocument(): IHTMLDocument2;
begin
Result :=
nil;
if Assigned(Document)
then
ControlInterface.Document.QueryInterface(IHTMLDocument2, Result);
end;
procedure TMyWebBrowser.SetShowScrollBars(
const Value: Boolean);
const
OverFlow:
Array[0..1]
of string = ('
hidden', '
');
var
ActDocument: IHTMLDocument2;
begin
FShowScrollbars := Value;
ActDocument := GetActualDocument();
if Assigned(ActualDocument)
and Assigned(ActualDocument.Body)
and Assigned(ActualDocument.Body.Style)
then
ActualDocument.Body.Style.overflow := OverFlow[Integer(Value)];
end;
end.
in der Zeile
if Assigned(ActualDocument) and Assigned(ActualDocument.Body) and Assigned(ActualDocument.Body.Style) then
ist ActualDocument.Body nicht assigned.
jemand eine idee?