Карта сайта Kansoftware
НОВОСТИУСЛУГИРЕШЕНИЯКОНТАКТЫ
Разработка программного обеспечения
KANSoftWare

Как поменять цвет или стиль бордюра в TWebBrowser

Delphi , Интернет и Сети , Браузер

Как поменять цвет или стиль бордюра в TWebBrowser

IN ternet SEXplorer - русская поисковая программа для порносайтов.


uses
  MSHTML; 

procedure WB_SetBorderColor(Sender: TObject; BorderColor: String); 
{ 
  BorderColor: Can be specified in HTML pages in two ways. 
               1) by using a color name (red, green, gold, firebrick, ...) 
               2) or by using numbers to denote an RGB color value. (#9400D3, #00CED1,...) 

  See: http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/
    reference/properties/borderstyle.asp
} 

var 
  Document : IHTMLDocument2; 
  Element : IHTMLElement; 
begin 
  Document := TWebBrowser(Sender).Document as IHTMLDocument2; 
  if Assigned(Document) then 
  begin 
    Element := Document.Body; 
    if Element <> nil then 
    begin 
      Element.Style.BorderColor := BorderColor; 
    end; 
  end; 
end; 

procedure WB_SetBorderStyle(Sender: TObject; BorderStyle: String); 
{ 
  BorderStyle values: 

  'none'         No border is drawn 
  'dotted'       Border is a dotted line. (as of IE 5.5) 
  'dashed'       Border is a dashed line. (as of IE 5.5) 
  'solid'        Border is a solid line. 
  'double'       Border is a double line 
  'groove'       3-D groove is drawn 
  'ridge'        3-D ridge is drawn 
  'inset'        3-D inset is drawn 
  'window-inset' Border is the same as inset, but is surrounded by an additional single line 
  'outset'       3-D outset is drawn 

  See: http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/
    reference/properties/borderstyle.asp 
} 

var 
  Document : IHTMLDocument2; 
  Element : IHTMLElement; 
begin 
  Document := TWebBrowser(Sender).Document as IHTMLDocument2; 
  if Assigned(Document) then 
  begin 
    Element := Document.Body; 
    if Element <> nil then 
    begin 
      Element.Style.BorderStyle := BorderStyle; 
    end; 
  end; 
end; 

procedure WB_Set3DBorderStyle(Sender: TObject; bValue: Boolean); 
{ 
  bValue: True: Show a 3D border style 
          False: Show no border 
} 
var 
  Document : IHTMLDocument2; 
  Element : IHTMLElement; 
  StrBorderStyle: string; 
begin 
  Document := TWebBrowser(Sender).Document as IHTMLDocument2; 
  if Assigned(Document) then 
  begin 
    Element := Document.Body; 
    if Element <> nil then 
    begin 
      case BValue of 
        False: StrBorderStyle := 'none'; 
        True: StrBorderStyle := ''; 
      end; 
      Element.Style.BorderStyle := StrBorderStyle; 
    end; 
  end; 
end; 



procedure TForm1.WebBrowser1NavigateComplete2(Sender: TObject; 
  const pDisp: IDispatch; var URL: OleVariant); 
// Put this code in the OnDocumentComplete event as well 
begin 
  // Examples: 
  // Show no border 
  WB_Set3DBorderStyle(Sender, False); 
  // Draw a double line border 
  WB_SetBorderStyle(Sender, 'double'); 
  // Set a border color 
  WB_SetBorderColor(Sender, '#6495ED'); 
end; 

procedure TForm1.Button1Click(Sender: TObject); 
begin 
  Webbrowser1.Navigate('www.SwissDelphiCenter.ch'); 
end;

Статья Как поменять цвет или стиль бордюра в TWebBrowser раздела Интернет и Сети Браузер может быть полезна для разработчиков на Delphi и FreePascal.


Комментарии и вопросы


Ваше мнение или вопрос к статье в виде простого текста (Tag <a href=... Disabled). Все комментарии модерируются, модератор оставляет за собой право удалить непонравившейся ему комментарий.

заголовок

e-mail

Ваше имя

Сообщение

Введите код




Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.



:: Главная :: Браузер ::


реклама



©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007
Top.Mail.Ru Rambler's Top100
29.03.2024 11:43:00/0.036720037460327/0