LRESULT	CDebugCommandsView::OnSizing(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
    CRect listRect;
    m_CommandList.GetWindowRect(listRect);

    CRect headRect;
    CHeaderCtrl listHead = m_CommandList.GetHeader();
    listHead.GetWindowRect(&headRect);

    int rowsHeight = listRect.Height() - headRect.Height();

    int nRows = (rowsHeight / m_RowHeight);

    if (m_CommandListRows != nRows)
    {
        m_CommandListRows = nRows;
        ShowAddress(m_StartAddress, TRUE);
    }

    m_RegisterTabs.RedrawCurrentTab();

    // Fix cmd list header
    listHead.ResizeClient(listRect.Width(), headRect.Height());

    return FALSE;
}
Example #2
0
void CNBBindListViewCtrl::OnPaint(HDC /*wParam*/)
{
	CRect rtCol, rtHeader, rtSubItem;
	CHeaderCtrl header = GetHeader();
	header.GetWindowRect( rtHeader );
	ScreenToClient( rtHeader );
	header.GetItemRect( 0, rtCol) ;
	rtCol.OffsetRect( rtHeader.TopLeft() );

	while ( !m_vtRowHeader.empty() )
	{
		CCustomStaticCtrl *pWnd = m_vtRowHeader.front();
		m_vtRowHeader.pop_front();
		pWnd->DestroyWindow();
		delete pWnd;
	}

	// For vertical scroll.
	if ( GetItemCount() > 0 )
	{
		GetSubItemRect(0, 0, LVIR_BOUNDS, rtSubItem);
	}
	else
	{
		rtSubItem.top = rtCol.bottom;
	}

	for ( UINT i=0; i < m_nMaxCount; i++ )
	{
		CCustomStaticCtrl *pWnd;
		CStatic staticCtrl;
		pWnd = new CCustomStaticCtrl;
		CRect rtItem;
		static int nHeight = 14;
		rtItem.left = rtCol.left;
		rtItem.right = rtCol.right-2;
		rtItem.top = rtSubItem.top + i * nHeight;
		rtItem.bottom = rtItem.top + nHeight-1;
		
		if ( rtItem.top < rtCol.bottom )
			continue;
		WTL::CString strTitle;
		strTitle.Format(_T("%d"), i);
		staticCtrl.Create( m_hWnd, rtItem, strTitle,
			WS_CHILD | SS_CENTER | WS_DISABLED);
		staticCtrl.ShowWindow( SW_SHOW );
		pWnd->SubclassWindow( staticCtrl.m_hWnd );
		m_vtRowHeader.push_back( pWnd );
	}
	DefWindowProc();
}
Example #3
0
void CEnListCtrl::OnPaint() 
{
	// if no items or in report mode draw to back buffer then blt
	if (GetItemCount() && GetView() != LVS_REPORT)
		Default();

	else
	{
		CPaintDC cleanup(this);

		CHeaderCtrl* pHeader = GetHeader();
		CDC& paintdc = *GetDC();

		CDC dc;
		dc.CreateCompatibleDC(&paintdc);
		
		CRect rClient;
		GetClientRect( &rClient );
		
		CBitmap bitmap;
		bitmap.CreateCompatibleBitmap(&paintdc, rClient.right, rClient.bottom);
		CBitmap *pOldBitmap = dc.SelectObject(& bitmap);
			
		if (pHeader && m_nCurView == LVS_REPORT && !(GetStyle() & LVS_NOCOLUMNHEADER))
		{
			CRect rHeader;
			pHeader->GetWindowRect(&rHeader);
			ScreenToClient(rHeader);
			dc.ExcludeClipRect(rHeader);
			rClient.top = rHeader.bottom;
		}

		// fill with back color
		COLORREF crBack = GetItemBackColor(0, FALSE, FALSE, FALSE);

		dc.FillSolidRect(rClient, crBack);

		// default drawing
		CListCtrl::DefWindowProc(WM_PAINT, (WPARAM)dc.m_hDC, 0);
		
		// do empty text if nec
		if (GetItemCount() == 0)
		{
			CString sText = GetNoItemsText(); // virtual call

			if (!sText.IsEmpty())
			{
				sText.TrimRight();
				sText.TrimLeft();

				if (sText[0] != '(')
					sText = "(" + sText;

				if (sText[sText.GetLength() - 1] != ')')
					sText += ")";
			
				dc.SetTextColor(::GetSysColor(COLOR_WINDOWTEXT));
				dc.SetBkColor(crBack);
				dc.SelectStockObject( ANSI_VAR_FONT );

				rClient.top += 10;
				dc.DrawText( sText, rClient, DT_CENTER | DT_WORDBREAK | DT_NOPREFIX/* | DT_NOCLIP */);
				rClient.top -= 10; // reset
			}
		}

		paintdc.BitBlt(0, rClient.top, rClient.right, rClient.bottom, 
					   &dc, 0, rClient.top, SRCCOPY);

		dc.SelectObject(pOldBitmap);
		ReleaseDC(&paintdc);
	}

	// Do not call CListView::OnPaint() for painting messages
}