• Sign In
 
  • MSDN Blogs
  • Microsoft Blog Images
  • More ...
Common Tasks
  • Blog Home
  • Email Blog Author
  • RSS for comments
  • RSS for posts
Search
  • Advanced search options...
Tags
  • .NET Framewor
  • .NET Framework
  • Ajax/Javascript
  • ASP.NET
  • CLR
  • Cool stuff
  • DataAccess
  • Debugging/Windbg
  • Hotfix/Service Pack
  • IDEVDataCollector
  • IIS
  • Internet Explorer
  • Italian techs
  • LogParser
  • OT
  • Personal
  • Productivity
  • Random
  • Scripting/ASP
  • Security
  • Technology
  • Tools
  • Troubleshooting
  • Vista/Longhorn
  • Visual Studio
Archives
Archives
  • November 2010 (1)
  • October 2010 (1)
  • July 2010 (2)
  • April 2010 (1)
  • March 2010 (2)
  • February 2010 (2)
  • January 2010 (1)
  • October 2009 (2)
  • September 2009 (2)
  • August 2009 (1)
  • July 2009 (5)
  • June 2009 (1)
  • May 2009 (1)
  • April 2009 (3)
  • March 2009 (3)
  • February 2009 (5)
  • January 2009 (3)
  • December 2008 (5)
  • November 2008 (3)
  • October 2008 (2)
  • September 2008 (3)
  • August 2008 (3)
  • July 2008 (3)
  • June 2008 (5)
  • May 2008 (4)
  • April 2008 (8)
  • March 2008 (4)
  • February 2008 (5)
  • January 2008 (2)
  • December 2007 (4)
  • November 2007 (6)
  • October 2007 (6)
  • September 2007 (8)
  • August 2007 (6)
  • July 2007 (7)
  • June 2007 (10)
  • May 2007 (9)
  • April 2007 (12)
  • March 2007 (8)
  • February 2007 (5)
  • January 2007 (3)
  • December 2006 (1)
  • November 2006 (4)
  • October 2006 (2)
  • September 2006 (9)
  • August 2006 (2)
  • July 2006 (1)

Windows Control Library does not resize correctly if you change IE window size

MSDN Blogs > Never doubt thy debugger > Windows Control Library does not resize correctly if you change IE window size

Windows Control Library does not resize correctly if you change IE window size

Carlo Cardella
24 Apr 2007 6:15 PM
  • Comments 2

 

Hosting a Windows Control Library control in an ASP.NET 2.0 page, the WCL does not resize correctly, if you change the size of the IE Window. The problem does not occur using .NET Framework 1.1

The problem is a regression in Visual Studio 2005 which prevents the .Net ActiveX implementation from asserting managed code privilege when calling IOleClientSite::OnPosRectChange. Since that call requires managed code execution privileges, it fails and the control cannot resize itself.

The workaround is to set the size of the control from the HTML rather than resizing it internally. For example, the onresize in the body tag in the following script does this:

<html> 
    <body onresize="obj1.Width=document.body.clientWidth;"> 
        <div style="width:100%;height:100%;background-color:blue"> 
            <OBJECT id="obj1" height="90%" width="90%" 
classid="MyResizeControl.dll#MyResizeControl.UserControl1" VIEWASTEXT /> </div> <br>
This is a long string for me to test the other space </body> </html>

Capitalization of the properties is important: capital "W" (Width) will correctly change the Width property of the internal .Net control; lowercase "w" (width) will change the property of the HTML object rather than the .Net object, and this will not work if the .Net object is 1.1.

 

Cheers

  • 2 Comments
ASP.NET, Visual Studio
Leave a Comment
  • Please add 4 and 5 and type the answer here:
  • Post
Comments
  • Kishan
    28 Oct 2007 12:31 PM

    Hi, nice article but i have written some code in one of the events but events doesnt run. if i want to run the events on web then is there anyway of doing it?

  • Carlo Cardella
    28 Oct 2007 12:41 PM

    Hi Kishan, which event are you trying to use? Could you post (or send to me through the "email" link) some sample to show the problem?

    Thanks

Page 1 of 1 (2 items)
  • © 2012 Microsoft Corporation.
  • Terms of Use
  • Trademarks
  • Privacy Statement
  • Report Abuse
  • 5.6.402.223