本文整理汇总了C++中CDCHandle::InvertRect方法的典型用法代码示例。如果您正苦于以下问题:C++ CDCHandle::InvertRect方法的具体用法?C++ CDCHandle::InvertRect怎么用?C++ CDCHandle::InvertRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDCHandle
的用法示例。
在下文中一共展示了CDCHandle::InvertRect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoLButtonDown
LRESULT CDrawHeader::DoLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
POINT point;
point.x = GET_X_LPARAM(lParam);
point.y = GET_Y_LPARAM(lParam);
m_ptLastLButtonDown = point;
if (!m_bColumnResizing)
{
m_pAlmSum->SetCapture(TRUE, this);
if (MouseOverColumnResizeArea(point))
{
SetCursor(m_hColDivCursor);
m_bColumnResizing = TRUE;
}
else
{
m_nColumnCatpture = GetColumn(point);
CDCHandle dcHandle = m_pAlmSum->GetDC();
DoDraw(dcHandle);
m_pAlmSum->ReleaseDC(dcHandle);
}
}
if (m_bColumnResizing)
{
if (!GetResizeColumn(point, m_nResizingColumn, m_nDragDivideOffset))
return 1;
CRect rect = m_pAlmSum->m_rect;
CRect invertedRect(point.x - 1 - m_nDragDivideOffset, rect.top,
point.x - m_nDragDivideOffset, rect.bottom);
CDCHandle dcHandle = m_pAlmSum->GetDC();
dcHandle.InvertRect(&invertedRect);
m_pAlmSum->ReleaseDC(dcHandle);
}
return 0;
}
示例2: DoMouseMove
LRESULT CDrawHeader::DoMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
POINT point;
point.x = GET_X_LPARAM(lParam);
point.y = GET_Y_LPARAM(lParam);
UINT nFlags = wParam;
if (!(nFlags & MK_LBUTTON))
{
if (MouseOverColumnResizeArea(point) && m_nColumnCatpture == -1)
{
SetCursor(m_hColDivCursor);
}
else
{
SetCursor(LoadCursor(NULL, IDC_ARROW));
}
}
if (nFlags & MK_LBUTTON)
{
if (m_bColumnResizing)
{
//SetCursor(m_hColDivCursor);
CRect rect = m_pAlmSum->m_rect;
CDCHandle dcHandle = m_pAlmSum->GetDC();
int nMinX = m_ptLastLButtonDown.x - m_nDragDivideOffset - m_pAlmSum->GetColumnWidth(m_nResizingColumn);
int nXPos = max(m_ptLastMousePoint.x, nMinX);
CRect oldInvertedRect(nXPos - 1 - m_nDragDivideOffset, rect.top,
nXPos - m_nDragDivideOffset, rect.bottom);
dcHandle.InvertRect(&oldInvertedRect);
nXPos = max(point.x, nMinX);
CRect newInvertedRect(nXPos - 1 - m_nDragDivideOffset, rect.top,
nXPos - m_nDragDivideOffset, rect.bottom);
dcHandle.InvertRect(&newInvertedRect);
m_pAlmSum->ReleaseDC(dcHandle);
}
else if (m_nColumnCatpture != -1)
{
int nCol = GetColumn(point);
if (nCol != m_nColumnCatpture)
{
m_nColumnCatpture = -1;
CDCHandle dcHandle = m_pAlmSum->GetDC();
DoDraw(dcHandle);
m_pAlmSum->ReleaseDC(dcHandle);
m_pAlmSum->SetCapture(FALSE, this);
}
}
}
m_ptLastMousePoint = point;
return 0;
}
示例3: DoLButtonUp
LRESULT CDrawHeader::DoLButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
POINT point;
point.x = GET_X_LPARAM(lParam);
point.y = GET_Y_LPARAM(lParam);
m_pAlmSum->SetCapture(FALSE, this);
if (m_bColumnResizing)
{
int nMinX = m_ptLastLButtonDown.x - m_nDragDivideOffset - m_pAlmSum->GetColumnWidth(m_nResizingColumn);
int nXPos = max(m_ptLastMousePoint.x, nMinX);
CRect rect = m_pAlmSum->m_rect;
CRect invertedRect(nXPos - 1 - m_nDragDivideOffset, rect.top,
nXPos - m_nDragDivideOffset, rect.bottom);
CDCHandle dcHandle = m_pAlmSum->GetDC();
dcHandle.InvertRect(&invertedRect);
m_pAlmSum->ReleaseDC(dcHandle);
if (m_ptLastLButtonDown != point)
{
CPoint start;
nXPos = max(point.x, nMinX);
m_pAlmSum->SetColumnWidth(m_nResizingColumn, nXPos - m_ptLastLButtonDown.x + m_nDragDivideOffset + m_pAlmSum->GetColumnWidth(m_nResizingColumn));
m_pAlmSum->FireViewChange();
}
m_bColumnResizing = FALSE;
m_nResizingColumn = -1;
}
else if (m_nColumnCatpture != -1)
{
int nCol = GetColumn(point);
if (nCol == m_nColumnCatpture)
{
if (m_pAlmSum->m_nSortField == m_pAlmSum->m_apColumns[nCol]->m_enumAlarmField &&
m_pAlmSum->m_nSecondSortField == (enumAlarmField)-1)
{
m_pAlmSum->m_bSortAscending = !m_pAlmSum->m_bSortAscending;
}
else
{
m_pAlmSum->m_nSortField = m_pAlmSum->m_apColumns[nCol]->m_enumAlarmField;
m_pAlmSum->m_nSecondSortField = (enumAlarmField)-1;
}
CAlarm* pSelectAlarm = m_pAlmSum->GetSelectAlarm();
m_pAlmSum->ReSortAlarms();
m_pAlmSum->SelectAlarm(pSelectAlarm);
m_nColumnCatpture = -1;
}
else
{
m_nColumnCatpture = -1;
CDCHandle dcHandle = m_pAlmSum->GetDC();
DoDraw(dcHandle);
m_pAlmSum->ReleaseDC(dcHandle);
}
}
return 0;
}