Knowledge Base

How To Disable the Resizing of an OLE Control

Article ID: 137538

Article Last Modified on 11/21/2006


APPLIES TO


This article was previously published under Q137538

SUMMARY

To disable the resizing of an OLE Control, you need to override the COleControl::OnNcLButtonDown() and COleControl::OnSetExtent() functions.

MORE INFORMATION

The default implementation of COleControl::OnNcLButtonDown() initiates the tracker rectangle and changes the extent of the control based on the results.

The default implementation of COleControl::OnSetExtent() is called by the framework to change the size of the control based, at least in part, on the sizing handled by the client container.

To disable resizing, you need to disable the tracker rectangle supported by COleControl::OnNcLButtonDown() and ignore any size changes sent to COleControl::OnSetExtent().

To disable resizing in the Circle3 tutorial, override CCirc3Ctrl::OnSetExtent() and CCirc3Ctrl::OnNcLButtonDown() and implement as follows:
BOOL CCirc3Ctrl::OnSetExtent(LPSIZEL lpSizeL)
{
   return FALSE;
}

void CCirc3Ctrl::OnNcLButtonDown(UINT nHitTest, CPoint point)
{
   return;
}
				

Additional query words: resize static fixed

Keywords: kbctrl kbhowto kbnoupdate kbuidesign KB137538