描述:
我自己做了一个OCX控件,在OnDraw里画了一个32x32的图标,可是给别人用的时候发现,当设计时把ocx控件放到窗体上时,他的大小有150x100左右,我画的图标只占了左上角的一点位置,很难看,怎么把控件大小改成32x32
解决方案1:
First, we need to set the initial size of the control to its static size using the COleControl::SetInitialSize method. This should be done in your control's constructor like this:
////////////////////////////////////////////////
// CFAQCtrl::CFAQCtrl - Constructor
CFAQCtrl::CFAQCtrl()
{
InitializeIIDs(&IID_DFAQ, &IID_DFAQEvents);
SetInitialSize( 28, 28 );
}
override OnSetExtent and return FALSE, which tells the container that the control cannot be re-sized
BOOL CFAQCtrl::OnSetExtent( LPSIZEL lpSizeL )
{
return FALSE;
}
for more refer to
http://www.widgetware.com/FAQArticle.htm#Size