
Ok, consider this image.
I develop an IE extension in c
- the distance in red, between top of screen and top of `visible webpage`
- the distance in red between left of screen and left of `visible webpage`
- the width/heigth of the visible webpage
Of course, given that I have the entire screen size. If I have red and black, I can calculate the green color.
What is the point?
I have thousands of screen coordinates (X, Y), I have to calculate the coordinates relative to the web page.
Example :
Considering
Screen size : 1200 * 800
Webpage size : 400*300
Red distance between left screen border and left webpage border : 200
Red distance between top screen border and top webpage border : 300
So my coordinates screen => relative webpage becomes :
( 100, 100 ) => OUTSIDE WEBPAGE( ignored )
( 1100, 650 ) => OUTSIDE WEBPAGE ( ignored )
( 200, 300 ) => ( 0,0 )
( 250, 400 ) => ( 50, 100 )
Actually I have this code, thisinherited from AddinExpress.IE.ADXIEModule, thetoolbarObj is the toolbar that I added to InternetExplorer. Therefore, I can use pointToScreen on it, and I'm not far from what I need, but the left corner of the toolbar is not what I need, I need the left user of the web page.
public void getUtilsDimension()
{
Rectangle resolution = Screen.PrimaryScreen.Bounds;
Int32 screenWidth = resolution.Width;
Int32 screenHeight = resolution.Height;
AddinExpress.IE.ADXIEToolBarItem toolbarItem = this.ToolBars[0];
AddinExpress.IE.ADXIEToolbar toolbarObj = toolbarItem.ToolBarObj;
Point leftCornerWebPage = toolbarObj.PointToScreen(new Point(0, 0));
Int32 toolbarHeight = toolbarObj.Height;
Int32 toolbarWidth = toolbarObj.Width;
Debug.WriteLine("Largeur écran : " + screenWidth);
Debug.WriteLine("Hauteur écran : " + screenHeight);
Debug.WriteLine("LeftCornerX : " + leftCornerWebPage.X);
Debug.WriteLine("LeftCornerY : " + leftCornerWebPage.Y);
Debug.WriteLine("toolbarHeight : " + toolbarHeight);
Debug.WriteLine("toolbarWidth : " + toolbarWidth);
}
, , 1600 * 900, pointToScreen (484,158). , -. , $(window) JQuery, , #.
HTLMDocument (typeof mshtml.HTMLDocument) this.HTMLDocument, , pointToScreen HTMLDocument.

: , , , IE
08/12
- ( )
- 2
var heightVisibleWebPage = HTMLDocument.documentElement.offsetHeight;
var widthVisibleWebPage = HTMLDocument.documentElement.offsetWidth;
. . Internet, /// .
08/12 HTMLDocument
HTMLDocument - AddinExpress, System.Windows.Forms.HtmlDocument
public mshtml.HTMLDocument HTMLDocument
{
get
{
return (this.HTMLDocumentObj as mshtml.HTMLDocument);
}
}
HTMLDocument.parentWindows - IHTMLWindow2
HTMLDocumentObj
public class ADXIEModule : Component, IRemoteModule2, IRemoteModule, IObjectWithSite, IWin32Window
{
...
[Browsable(false)]
public object HTMLDocumentObj { get; }
...
}
, -1 , ;)