The problem is the scroll, I created a derived class of CListCtrl,
void CListBut::CalculateCellRect(int iColumnIndex, int iRowIndex, CRect& robCellRect)
{
GetItemRect(iRowIndex, &robCellRect, LVIR_BOUNDS);
CRect rcClient;
GetClientRect(&rcClient);
if (robCellRect.right > rcClient.right)
{
robCellRect.right = rcClient.right;
}
ScrollToView(iColumnIndex, iRowIndex, robCellRect);
INT_PTR nRow, nCol;
RECT cellRect;
CArray<double, double> a_Rdim;
CArray<double, double> a_RdimApp;
CButton * but = new CButton;
but->Create(_T(""), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, robCellRect, this, 1);
}
<pre>
void CListBut::ScrollToView(int iColumnIndex, int iRowIndex, CRect& robCellRect)
{
CRect rcClient;
GetClientRect(&rcClient);
int iColumnWidth = GetColumnWidth(iColumnIndex);
int iOffSet = 0;
int iOffSet1 = 0;
for (int iIndex_ = 0; iIndex_ < iColumnIndex; iIndex_++)
{
iOffSet += GetColumnWidth(iIndex_);
}
CSize obScrollSize(0, 0);
if (((iOffSet + robCellRect.left) < rcClient.left) ||
((iOffSet + robCellRect.left) > rcClient.right))
{
obScrollSize.cx = iOffSet + robCellRect.left;
}
else if ((iOffSet + robCellRect.left + iColumnWidth) > rcClient.right)
{
obScrollSize.cx = iOffSet + robCellRect.left + iColumnWidth - rcClient.right;
}
robCellRect.left -= obScrollSize.cx;
robCellRect.left += iOffSet;
robCellRect.right = robCellRect.left + iColumnWidth;
}
What I have tried:
I tried code that I wrote..When I scroll button's position changes..