2016-07-05 3 views
0

델파이 폼에 EmbeddedWB 구성 요소가 있고 다른 페이지의 웹 브라우저로 사용하고 있습니다.Deplhi TEmbeddedWB 요소가 표시되는지 확인합니다.

IHTMLelement이 표시되는지 여부를 확인할 수있는 방법이 있습니까? 나는 ihtmlelement.style.display 속성에 대해 알고 있고, 'none'으로 설정하면 요소가 보이지 않습니다. 하지만 부모 요소 또는 부모 요소의 부모 요소 (기타 등)가 숨겨져 있다면 어떻게 될까요?

어떻게 표시 되나요?

내 코드 - 그게하지

변수 tag2: IHTMLElement2;

tag2:=tag as ihtmlelement2; 

if tag2.currentstyle.display<>'none' then ... 

내 문제를 해결 추가 적절하게 제안

답변

1

나는 그것을 해결 확인을위한

var 
document:ihtmldocument2; 
body:ihtmlelement2; 
i:integer; 
tag:ihtmlelement; 
tags:IHTMLElementCollection; 

... 

document:=embeddedwb.document as ihtmldocument2; 
body:=document.body as ihtmlelement2; 

if assigned(body) then begin 

    Tags := Body.getElementsByTagName('*'); 

    for i := 0 to Tags.length-1 do 
    begin 

    try 
    Tag := Tags.item(I, EmptyParam) as IHTMLElement; 
    except 
    tag:=nil; 
    end; 
    if tag.style.display<>'none' then begin 
// this condition is not good, because the tag.style.display is usually set to '' so it not telling me, if the tag is really visible or not... 
... 


... 

덕분에 ... 작동

+0

tag2는 IHTMLElement2이고, 태그는 ITHMLElement입니다. ihtmlelement2는 currentstyle 속성을 가지고있어 요소의 실제 표시 상태를 보여줍니다. – IanF