Reputation: 41
I have a custom explorer bar (a band object) that hosts a webbrowser control. I can initialize the WebBrowser control properly and have it display web pages.
However, I've noticed that when I resize the explorer bar, the webbrowser control doesn't resize appropriately to the size of the bar:
I'm not sure what events I need to handle and what can resize the browser control. I have some experience in .NET programming, and none really in Windows programming.
I've also included my source code here if you would like to poke aorund it more.
Upvotes: 2
Views: 1448
Reputation: 86474
This 'answer' doesn't relate directly to the original question, but I came across this page while trying to find a solution for a very similar issue.
Whenever I moved the splitter about it would always ping back to the original position. Turns out that DESKBANDINFO
mode flags are not particularly well named for vertical sidebars. I was using DBIMF_NORMAL
when I should have been using DBIMF_VARIABLEHEIGHT
.
Example code:
STDMETHODIMP CMyExplorerBar::GetBandInfo(DWORD dwBandID,
DWORD dwViewMode,
DESKBANDINFO* pdbi)
{
if(pdbi)
{
m_dwBandID = dwBandID;
m_dwViewMode = dwViewMode;
if(pdbi->dwMask & DBIM_MINSIZE)
{
pdbi->ptMinSize.x = 30;
pdbi->ptMinSize.y = 30;
}
if(pdbi->dwMask & DBIM_MAXSIZE)
{
pdbi->ptMaxSize.x = -1;
pdbi->ptMaxSize.y = -1;
}
if(pdbi->dwMask & DBIM_INTEGRAL)
{
pdbi->ptIntegral.x = 1;
pdbi->ptIntegral.y = 1;
}
if(pdbi->dwMask & DBIM_ACTUAL)
{
pdbi->ptActual.x = 500;
pdbi->ptActual.y = 0;
}
if(pdbi->dwMask & DBIM_TITLE)
{
StringCchCopy(pdbi->wszTitle, 256, L"My Sidebar");
}
if(pdbi->dwMask & DBIM_MODEFLAGS)
{
pdbi->dwModeFlags = DBIMF_VARIABLEHEIGHT;
}
if(pdbi->dwMask & DBIM_BKCOLOR)
{
pdbi->dwMask &= ~DBIM_BKCOLOR;
}
return S_OK;
}
return E_INVALIDARG;
}
Upvotes: 0
Reputation: 36026
Typically, when a container hosting an OLE control is resized, it queries the embedded object for its IOleInPlaceObject interface, and uses the SetObjectRects() on that interface to tell the control its new size.
Upvotes: 2