Registriert seit: 23. Aug 2011
2 Beiträge
|
AW: SVG im TWebBrowser manipulieren
17. Mär 2015, 14:41
Hi,
also, z.Zt. rufe ich folgende Funktion auf: (SvgDoc = ISVGDocument)
Delphi-Quellcode:
procedure MakeTextBox(textElement: ISvgTextContentElement);
var
doc: IHTMLDocument7;
newHtmlElement: IHTMLElement;
parentNode: IHTMLElement;
parentNodeNode: IHTMLDOMNode;
oldHtmlNode: IHTMLDOMNode;
newHtmlNode: IHTMLDOMNode;
textHtmlElement: IHtmlElement;
begin
SvgDoc.QueryInterface(IID_IHTMLDocument7, doc);
NS := 'http://www.w3.org/2000/svg';
newHtmlElement := doc.createElementNS(NS, 'rect');
setAttributeNS(newHtmlElement, cSVGstroke, ColorToSvgColor(clBlue));
setAttributeNS(newHtmlElement, cSVGfill, ColorToSvgColor(clBlue));
setAttributeNS(newHtmlElement, 'x', 10);
setAttributeNS(newHtmlElement, 'y', 10);
setAttributeNS(newHtmlElement, 'width', 50);
setAttributeNS(newHtmlElement, 'height', 50);
newHtmlElement.QueryInterface(IID_IHTMLDOMNode, newHtmlNode);
textElement.QueryInterface(IID_IHTMLElement, textHtmlElement);
parentNode := textHtmlElement.parentElement;
parentNode.QueryInterface(IID_IHTMLDOMNode, parentNodeNode);
textElement.QueryInterface(IID_IHTMLDOMNode, oldHtmlNode);
// parentNodeNode.removeChild(oldHtmlNode);
// parentNodeNode.appendChild(newHtmlNode);
// parentNodeNode.insertBefore(newHtmlNode, oldHtmlNode);
newHtmlNode := parentNodeNode.replaceChild(newHtmlNode, oldHtmlNode);
end;
Die Erzeugung per Javascript hatte ich auch schon gefunden / ausprobiert - das geht. Nur aus Delphi bekomme ich es nicht hin. Wobei er es ja scheinbar richtig einfügt, wie gesagt, speichern und neuladen, dann ist alles wie es sein soll - nur für mich keine Lösung
Danke!
|
|
Zitat
|