Re: Replace Titlebar with Region ?
I tried the code (below) and it caused erratic dragging behaviour.
However, I had a question first. How is the memory allocated for this
CArray<CRect> array?
And for dragging the dialog, it opens correctly. But when attempting to
drag the dialog, it only will move after a few clicks. And it so erratic
that the number of clicks is not consistent. In fact, I can't even
necessarliy reproduce dragging movement, and I'm not exactly sure how to get
the dragging movement started. Also, the dialog can be dragged from anywhere
in the dialog, not just the border controls.
Here is the code:
=====
#include <afxtempl.h>
added to the stdafx.h file
=====
class CBmpBkgdTBarDlg
{
private:
CArray<CRect,CRect&> rectArray;
}
=====
BOOL CBmpBkgdTBarButtonsDlg::OnInitDialog()
{
CRect r;
m_cTopBorder.GetWindowRect(&r);
rectarray.Add(r);
m_cLeftBorder.GetWindowRect(&r);
rectarray.Add(r);
m_cRightBorder.GetWindowRect(&r);
rectarray.Add(r);
m_cBottomBorder.GetWindowRect(&r);
rectarray.Add(r);
}
=====
UINT CBmpBkgdTBarButtonsDlg::OnNcHitTest(CPoint point)
{
CPoint pCur;
::GetCursorPos(&pCur);
for(int i = 0; i < rectArray.GetSize(); i++)
{
if(rectArray[i].PtInRect(pCur))
return HTCAPTION;
}
return CDialog::OnNcHitTest(point);
}
=====