예제 #1
0
        internal HtmlElement(HtmlShimManager shimManager, UnsafeNativeMethods.IHTMLElement element)
        {
            this.htmlElement = element;
            Debug.Assert(this.NativeHtmlElement != null, "The element object should implement IHTMLElement");

            this.shimManager = shimManager;

        }
예제 #2
0
        public HtmlElement this[int index] {
            get {
                //do some bounds checking here...
                if (index < 0 || index >= Count)
                {
                    throw new ArgumentOutOfRangeException(nameof(index), index, string.Format(SR.InvalidBoundArgument, nameof(index), index, 0, Count - 1));
                }

                if (this.NativeHtmlElementCollection != null)
                {
                    UnsafeNativeMethods.IHTMLElement htmlElement =
                        this.NativeHtmlElementCollection.Item((object)index, (object)0) as UnsafeNativeMethods.IHTMLElement;
                    return((htmlElement != null) ? new HtmlElement(shimManager, htmlElement) : null);
                }
                else if (elementsArray != null)
                {
                    return(this.elementsArray[index]);
                }
                else
                {
                    return(null);
                }
            }
        }
예제 #3
0
 public HtmlElement InsertAdjacentElement(HtmlElementInsertionOrientation orient, HtmlElement newElement)
 {
     UnsafeNativeMethods.IHTMLElement iHtmlElement = ((UnsafeNativeMethods.IHTMLElement2) this.NativeHtmlElement).InsertAdjacentElement(orient.ToString(),
                                                                                                                                        (UnsafeNativeMethods.IHTMLElement)newElement.DomElement);
     return(iHtmlElement != null ? new HtmlElement(shimManager, iHtmlElement) : null);
 }
예제 #4
0
 /// <include file='doc\HtmlDocument.uex' path='docs/doc[@for="HtmlDocument.CreateElement"]/*' />
 public HtmlElement CreateElement(string elementTag)
 {
     UnsafeNativeMethods.IHTMLElement iHTMLElement = this.NativeHtmlDocument2.CreateElement(elementTag);
     return(iHTMLElement != null ? new HtmlElement(ShimManager, iHTMLElement) : null);
 }
예제 #5
0
 /// <include file='doc\HtmlDocument.uex' path='docs/doc[@for="HtmlDocument.GetElementFromPoint"]/*' />
 public HtmlElement GetElementFromPoint(Point point)
 {
     UnsafeNativeMethods.IHTMLElement iHTMLElement = this.NativeHtmlDocument2.ElementFromPoint(point.X, point.Y);
     return(iHTMLElement != null ? new HtmlElement(ShimManager, iHTMLElement) : null);
 }
예제 #6
0
 /// <include file='doc\HtmlDocument.uex' path='docs/doc[@for="HtmlDocument.GetElementById"]/*' />
 public HtmlElement GetElementById(string id)
 {
     UnsafeNativeMethods.IHTMLElement iHTMLElement = ((UnsafeNativeMethods.IHTMLDocument3) this.NativeHtmlDocument2).GetElementById(id);
     return(iHTMLElement != null ? new HtmlElement(ShimManager, iHTMLElement) : null);
 }