Hello,
I want the columns in my CExtGridWnd to resize to fit when I double click the top left corner cell. So I overruled OnGbwAnalyzeCellMouseClickEvent like below.
This works OK except that resizing only takes effect after I move the cursor to another cell. Obviously I want to see the effect immediately after I double clicked. How can I do this?
Thanks in advance.
bool CGradingTableGrid::OnGbwAnalyzeCellMouseClickEvent(UINT nChar, UINT nRepCnt, UINT nFlags, CPoint point)
{
bool handled = __super::OnGbwAnalyzeCellMouseClickEvent(nChar, nRepCnt, nFlags, point);
CExtGridHitTestInfo htInfo;
htInfo.m_ptClient = point;
HitTest(htInfo, true, true);
switch (nRepCnt)
{
case 1: // single click
{
// ...
break;
}
case 2: // double click
{
if ((htInfo.m_dwAreaFlags & (__EGBWA_OUTER_TOP | __EGBWA_OUTER_LEFT)) == (__EGBWA_OUTER_TOP | __EGBWA_OUTER_LEFT))
{
for (LONG col = 0; col < ColumnCountGet(); col++)
{
BestFitColumn(col, 0, true, true, false, true);
}
Invalidate();
handled = true;
}
break;
}
}
return handled;
}