It have no pourpose resizing it to so small rect, just to a grip.
The same idea is to max vertical dropdown size. It should be (if auto size
selected) equal to max items size or if there are many items equal to rect
(from combo bottom to screen bottom).
http://www.codeproject.com/Messages/814977/Re-Suggestion.aspx
I agree with one_eddie's suggestion, and I edited CDropWnd::OnMouseMove
accordingly. I started by storing the listbox width and height calculated in
CDropWnd::OnCreate. I created two new variables in the private section of the
CDropWnd declaration in DropWnd.h as follows:
int m_nMaxX;
int m_nMaxY;
I initialize them in the CDropWnd::CDropWnd constructor to a large default
number (I chose 1000 - bad form, I know). I set them in CDropWnd::OnCreate just
before the SetWindowPos call as follows:
m_nMaxX = nW;
m_nMaxY = nH;
SetWindowPos( &wndTopMost, nX, nY, nW, nH, SWP_SHOWWINDOW|SWP_NOZORDER );
I then edited CDropWnd::OnMouseMove, replacing the following if-else blocks:
if( point.x + m_nMouseDiffX >= ::GetSystemMetrics(SM_CXVSCROLL) )
{...}
and
if( point.y + m_nMouseDiffY >= ::GetSystemMetrics(SM_CYVSCROLL) )
{...}
with the following code:
CRect rcCombo;
m_pComboParent->GetWindowRect( &rcCombo );
if( point.x + m_nMouseDiffX < rcCombo.Width())
{
rcWnd.right = rcWnd.left + rcCombo.Width();
}
else if (point.x + m_nMouseDiffX > m_nMaxX)
{
rcWnd.right = rcWnd.left + m_nMaxX;
}
else
{
rcWnd.right = rcWnd.left + point.x + m_nMouseDiffX;
}
and
if( point.y + m_nMouseDiffY < :: GetSystemMetrics(SM_CYVSCROLL) )
{
rcWnd.bottom = rcWnd.top + ::GetSystemMetrics(SM_CXVSCROLL) +1;
}
else if ( point.y + m_nMouseDiffY > m_nMaxY )
{
rcWnd.bottom = rcWnd.top + m_nMaxY;
}
else
{
rcWnd.bottom = rcWnd.top + point.y + m_nMouseDiffY +2;
}
I'm certainly not sure that this is the best way to do it, but it works for me.
Original issue reported on code.google.com by mathias....@gmail.com on 29 Sep 2010 at 9:22
Original issue reported on code.google.com by
mathias....@gmail.com
on 29 Sep 2010 at 9:22