Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / December 2004

Tip: Looking for answers? Try searching our database.

Resizing a tool window

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Thomas - 12 Dec 2004 16:49 GMT
Hi all,

I'm want to write a Visual Studio.NET AddIn which displays a tool window.
I've successfully created the tool window which host a user control. My
problem is, when I resize the tool window the user control is not resized.
I've overriden OnResize for the user control and have tried to adjust the
size of the user contol to the controls parents size. However, the OnResize
method is invoked but the Parent propertie of the user control is always
null.
How can I resize the user control hosted by the tool window?
...please help ;-)

Thanks
Thomas
Carlos J. Quintero [.NET MVP] - 13 Dec 2004 10:51 GMT
Your C++ shim control should have a code like this, to resize the hosted
.NET usercontrol (m_hwndUsercontrol):

// When the shim is resized, resize the hosted user control.
STDMETHOD(OnSize)(UINT, WPARAM, LPARAM lParam, BOOL& bHandled)
{
 if (m_hwndUsercontrol)
  ::MoveWindow(m_hwndUsercontrol, 0, 0, LOWORD(lParam), HIWORD(lParam),
true);

 bHandled = true;
 return 0;
}

and your .NET usercontrol should use the Resize event (no need to override
OnResize). In this event, the properties Width and Height of the usercontrol
already have the new values, you don´t need its parent...
Signature


Carlos J. Quintero

The MZ-Tools all-in-one add-in, now for .NET: http://www.mztools.com

> Hi all,
>
[quoted text clipped - 10 lines]
> Thanks
> Thomas
Thomas - 13 Dec 2004 21:05 GMT
It works!
Thanks
Thomas ;-)

> Your C++ shim control should have a code like this, to resize the hosted
> .NET usercontrol (m_hwndUsercontrol):
[quoted text clipped - 27 lines]
>> Thanks
>> Thomas

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.