Welcome to TalkGraphics.com
Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Browser size

  1. #1
    Join Date
    Jul 2008
    Location
    Montevideo, Uruguay
    Posts
    1,345

    Default Browser size

    Hello,
    I'm againg with some doubts.
    We are developing an application and We need to print some info that appear over an internet browser, that application is developed in C# and We are using WebBrowser.Document.Body.GetAttribute("scrollWidth ").ToString();.
    function to know the page's size, apparently it works in all pages but not with ones created with xara, does anybody know why?, is there any other way to get that data?.
    I really appreciate any cooperation.
    Best regards
    Javier

  2. #2
    Join Date
    Nov 2000
    Location
    Red Boiling Springs TN USA
    Posts
    19,208

    Default Re: Browser size

    Javier try the following:

    Code:
     
    WebBrowser.Document.Body.ScrollRectangle.Width.ToString();
    Soquili
    a.k.a. Bill Taylor
    Bill is no longer with us. He died on 10 Dec 2012. We remember him always.
    My TG Album
    Last XaReg update

  3. #3
    Join Date
    Jul 2008
    Location
    Montevideo, Uruguay
    Posts
    1,345

    Default Re: Browser size

    Bill,
    The same behaviour,
    Javier

  4. #4
    Join Date
    Nov 2000
    Location
    Red Boiling Springs TN USA
    Posts
    19,208

    Default Re: Browser size

    Javier please post a link to the page giving you the problem.

    Using the above code works well with my Web Designer page.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	test_CSharp_code.png 
Views:	120 
Size:	52.5 KB 
ID:	72780  
    Soquili
    a.k.a. Bill Taylor
    Bill is no longer with us. He died on 10 Dec 2012. We remember him always.
    My TG Album
    Last XaReg update

  5. #5
    Join Date
    Jul 2008
    Location
    Montevideo, Uruguay
    Posts
    1,345

    Default Re: Browser size

    Bill,
    Let me explain me better, the function is retrieving the width of the browser instead of the page size.
    Let me know if I'm clear.
    Best regards
    Javier

  6. #6
    Join Date
    Nov 2000
    Location
    Red Boiling Springs TN USA
    Posts
    19,208

    Default Re: Browser size

    Sorry Javier but I'm not understanding you most recent post.

    What property are you wanting? Browser width or page width?
    Soquili
    a.k.a. Bill Taylor
    Bill is no longer with us. He died on 10 Dec 2012. We remember him always.
    My TG Album
    Last XaReg update

  7. #7
    Join Date
    Jul 2008
    Location
    Montevideo, Uruguay
    Posts
    1,345

    Default Re: Browser size

    Bill,
    page width
    Thank you very much
    Javier

  8. #8

    Default Re: Browser size

    I have no idea what you and Bill are talking about, C# is a musical note as far as I am concerned, however the page size for Web Designer html documents is noted in the div under the body as a style attribute:

    <body>
    <div class="xr_ap" id="xr_xr" style="width: 955px; height: 700px; top:0px; left:50%; margin-left: -478px;">

  9. #9
    Join Date
    Nov 2000
    Location
    Red Boiling Springs TN USA
    Posts
    19,208

    Default Re: Browser size

    Javier to get the client width, the width of the object including padding, but not including margin, border, or scroll bar.

    Code:
     
    WebBrowser.Document.Body.GetAttribute("clientWidth", 0).ToString();
    An example from "The Code Project" website:
    http://www.codeproject.com/KB/graphi...px?msg=1640752
    Soquili
    a.k.a. Bill Taylor
    Bill is no longer with us. He died on 10 Dec 2012. We remember him always.
    My TG Album
    Last XaReg update

  10. #10
    Join Date
    Nov 2000
    Location
    Red Boiling Springs TN USA
    Posts
    19,208

    Default Re: Browser size

    Javier what version of C# are your using?

    There have been changes to objects and properties with newer versions of the Microsoft .NET languages.

    The code I originally posted was for C# 2008. The latest code example is for C# 2003.
    Soquili
    a.k.a. Bill Taylor
    Bill is no longer with us. He died on 10 Dec 2012. We remember him always.
    My TG Album
    Last XaReg update

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •