Autor Beitrag
N1m3
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 30


Borland Delphi 2005 Personal
BeitragVerfasst: So 20.11.05 11:55 
Hi zusammen

Wie kann man ein Bild in einem Form anklicken?
Im HTML Code steht nur:
ausblenden Quelltext
1:
<input type="image" src="../images/okn.gif" border="0" width="122" height="23">					


Gruss Nime
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: So 20.11.05 12:24 
Hallo,

Google ist dein Freund:

Suche bei Google TWEBBROWSER BILD KLICKEN IN DF
N1m3 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 30


Borland Delphi 2005 Personal
BeitragVerfasst: So 20.11.05 12:56 
Hi

hab jetzt diesen Code gefunden, doch leider macht der so gut wie gar nichts:


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
procedure TForm1.Button1Click(Sender: TObject);
var
  i: Word;
  Document: IHtmlDocument2;
  str: string;
begin
  // Schleife über alle Bilder im Webbrowser
  for i := 0 to WebBrowser1.OleObject.Document.Images.Length - 1 do
  begin
    Document := WebBrowser1.Document as IHtmlDocument2;
    // URL auslesen
    Str := (Document.Images.Item(i, 0as IHTMLImgElement).Href;
    // Dateiname des Bildes überprüfen
    if Pos('../images/okn.gif', str) <> 0 then
    begin
      ((Document.Images.Item(i, 0as IHTMLImgElement) as IHTMLElement).Click;
    end;
  end;
end;


www.swissdelphicente...showcode.php?id=1645

Wie kann er denn das Bild jetzt finden?
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: So 20.11.05 13:22 
schreibe mal anstatt '../images/okn.gif' nur 'okn.gif'
N1m3 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 30


Borland Delphi 2005 Personal
BeitragVerfasst: So 20.11.05 13:27 
Hab ich auch schon probiert.

Dann habe ich eine Mittelungsbox eingebaut:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
procedure TForm1.Button1Click(Sender: TObject);
var
  i: Word;
  Document: IHtmlDocument2;
  str: string;
begin
  // Schleife über alle Bilder im Webbrowser
  for i := 0 to WebBrowser1.OleObject.Document.Images.Length - 1 do
  begin
    Document := WebBrowser1.Document as IHtmlDocument2;
    // URL auslesen
    Str := (Document.Images.Item(i, 0as IHTMLImgElement).Href;

showmessage(Str); // Damit wollte ich überprüfen

    // Dateiname des Bildes überprüfen
    if Pos('../images/okn.gif', str) <> 0 then
    begin
      ((Document.Images.Item(i, 0as IHTMLImgElement) as IHTMLElement).Click;
    end;
  end;
end;


Es gibt zwar alle enthalten Blder an, nur das 'okn.gif' Bild nicht, das heisst es wird gar nicht gefunden, keine Ahnug wie weiter jetzt.
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: Mo 21.11.05 18:15 
Vielleicht befindet sich das Bild in einem anderen Frame?