コード例 #1
0
void CObjectRightView::OnSize(UINT nType, int cx, int cy) 
{
	SetScrollSizes( MM_TEXT, CSize(cx, cy) );

	CFormView::OnSize(nType, cx, cy);

	if	(initialized) {
		CRect rc;

		m_iWidth = cx;
		m_iHeight = cy;

		// Save static reference to the render window
		CWnd* pGroup = GetDlgItem(IDC_RENDERWINDOW);
		pGroup->SetWindowPos(NULL, 0, 0, cx, cy, SWP_NOZORDER);
		pGroup->GetClientRect(&rc);
		pGroup->MapWindowPoints(this, &rc);

		m_hwndRenderWindow = GetDlgItem(IDC_RENDERWINDOW)->GetSafeHwnd();
		
		InitializeDevice();
		InitializeDeviceBuffer();

		Render();
	}
}
コード例 #2
0
ファイル: PlayerStatusBar.cpp プロジェクト: Samangan/mpc-hc
BOOL CPlayerStatusBar::OnEraseBkgnd(CDC* pDC)
{
	for (CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow()) {
		if (!pChild->IsWindowVisible()) {
			continue;
		}

		CRect r;
		pChild->GetClientRect(&r);
		pChild->MapWindowPoints(this, &r);
		pDC->ExcludeClipRect(&r);
	}

	CRect r;
	GetClientRect(&r);

	CMainFrame* pFrame = ((CMainFrame*)GetParentFrame());

	if (pFrame->m_pLastBar != this || pFrame->m_fFullScreen) {
		r.InflateRect(0, 0, 0, 1);
	}

	if (pFrame->m_fFullScreen) {
		r.InflateRect(1, 0, 1, 0);
	}

	pDC->Draw3dRect(&r, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));

	r.DeflateRect(1, 1);

	pDC->FillSolidRect(&r, 0);

	return TRUE;
}
コード例 #3
0
ファイル: PlayerStatusBar.cpp プロジェクト: EchoLiao/mpc-hc
void CPlayerStatusBar::OnPaint()
{
    CPaintDC dc(this); // device context for painting

    for (CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow()) {
        if (!pChild->IsWindowVisible()) {
            continue;
        }

        CRect r;
        pChild->GetClientRect(&r);
        pChild->MapWindowPoints(this, &r);
        dc.ExcludeClipRect(&r);
    }

    CRect r;
    GetClientRect(&r);

    if (m_pMainFrame->m_pLastBar != this || m_pMainFrame->m_fFullScreen) {
        r.InflateRect(0, 0, 0, 1);
    }

    if (m_pMainFrame->m_fFullScreen) {
        r.InflateRect(1, 0, 1, 0);
    }

    dc.Draw3dRect(&r, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));

    r.DeflateRect(1, 1);

    dc.FillSolidRect(&r, 0);

    if (m_bm.m_hObject) {
        BITMAP bm;
        m_bm.GetBitmap(&bm);
        CDC memdc;
        memdc.CreateCompatibleDC(&dc);
        memdc.SelectObject(&m_bm);
        CRect clientRect;
        GetClientRect(&clientRect);
        CRect statusRect;
        m_status.GetWindowRect(statusRect);
        ScreenToClient(statusRect);
        dc.BitBlt(clientRect.right - bm.bmWidth - 1,
                  statusRect.CenterPoint().y - bm.bmHeight / 2,
                  bm.bmWidth, bm.bmHeight, &memdc, 0, 0, SRCCOPY);
    }
}
コード例 #4
0
ファイル: BaseGraph.cpp プロジェクト: Fluffiest/splayer
BOOL CPlayerWindow::OnEraseBkgnd(CDC* pDC)
{
	for(CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow())
	{
		if(!pChild->IsWindowVisible()) continue;

		CRect r;
		pChild->GetClientRect(&r);
		pChild->MapWindowPoints(this, &r);
		pDC->ExcludeClipRect(&r);
	}

	CRect r;
	GetClientRect(&r);
	pDC->FillSolidRect(&r, 0);

	return TRUE;
}
コード例 #5
0
BOOL CScanMemDlg::OnInitDialog()
{
    CDialog::OnInitDialog();

    if (m_pFvdBlock == NULL) {
        MessageBox (_T("Database error."), DEFCAPTION, MB_ICONERROR);
        EndDialog (0);
        return TRUE;
    }

    //m_enumMemObjArray.EnumObjects ();
    //if (m_enumMemObjArray.GetSize() == 0) {
    //    EndDialog (0);
    //    return TRUE;
    //}
    //m_enumStObjArray.EnumObjects ();
    m_enumMWObjArray.EnumObjects(ET_ALL);
    if (m_enumMWObjArray.GetSize() == 0) {
        EndDialog (0);
        return TRUE;
    }

    m_wndLvScanResult.SetExtendedStyle ( LVS_EX_CHECKBOXES | LVS_EX_FLATSB | LVS_EX_FULLROWSELECT |
        LVS_EX_GRIDLINES );
    int i = 0;
    m_wndLvScanResult.InsertColumn (i++, _T("File Name"), LVCFMT_LEFT, 250);
    m_wndLvScanResult.InsertColumn (i++, _T("Virus Name"), LVCFMT_LEFT, 160);
    m_wndLvScanResult.InsertColumn (i, _T("Information"), LVCFMT_LEFT, 220);

	// init the tooltip
	m_toolTipCtrl.Create(this);
	CWnd* pLblFilePath = GetDlgItem(IDC_LBLSCANFILE);
	RECT rect;
	pLblFilePath->GetClientRect(&rect);
	pLblFilePath->MapWindowPoints(this, &rect);
	m_toolTipCtrl.AddTool(this, _T(""), &rect, IDC_LBLSCANFILE);

    CScanMemDlg* pclsParam = this;
    m_pThread = ::AfxBeginThread (ThreadMemFunc, pclsParam);

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
コード例 #6
0
BOOL CDlgForEach::OnInitDialog()
{
	CDlgForBase::OnInitDialog();

	// TODO:  在此添加额外的初始化
	//InitGrid();
	m_nIndexSel = -1;

	m_dlgForEachListFrame.Create(IDD_FOR_EACH_LIST_FRAME, this);
	CWnd* wndGrid = GetDlgItem(IDC_STATIC_GRID);
	CRect rc;
	wndGrid->GetClientRect (&rc);
	wndGrid->MapWindowPoints (this, &rc);
	//wndGrid->ShowWindow(SW_HIDE);
	m_dlgForEachListFrame.MoveWindow(rc);
	m_dlgForEachListFrame.ShowWindow(SW_SHOW);

	m_dlgForEachList.Create(IDD_FOR_EACH_LIST, &m_dlgForEachListFrame);
	m_dlgForEachList.ShowWindow(SW_SHOW);


	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}
コード例 #7
0
//****************************************************************************************
void CBCGPFileDialog::CollectControls ()
{
	if (!m_lstFDControls.IsEmpty ())
	{
		return;
	}

	CWnd* pWnd = GetParent();
	ASSERT (pWnd != NULL);

	CRect rectList (0, 0, 0, 0);

	CWnd* pWndChild = pWnd->GetWindow (GW_CHILD);
	while (pWndChild != NULL)
	{
		BOOL bIsFileList = FALSE;

		UINT uiID = pWndChild->GetDlgCtrlID();
		TCHAR szClass [256];
		::GetClassName (pWndChild->GetSafeHwnd (), szClass, 255);

		CString strClass = szClass;

		CRect rectCtl;
		pWndChild->GetClientRect (rectCtl);
		pWndChild->MapWindowPoints (pWnd, rectCtl);

		if (strClass.CompareNoCase (_T("SHELLDLL_DefView")) == 0)
		{
			rectList.left = rectCtl.left;
			rectList.right = rectCtl.right;
			rectList.bottom = rectCtl.bottom - 10;

			bIsFileList = TRUE;
		}

		if (strClass.CompareNoCase (_T("ToolbarWindow32")) == 0)
		{
			rectList.top = rectCtl.top;
		}

		if ((((strClass.CompareNoCase (_T("BUTTON")) != 0) ||
			uiID != IDOK &&
			uiID != IDCANCEL &&
			uiID != IDHELP) &&
			pWndChild->GetStyle () & WS_VISIBLE) &&
			uiID != iTabCtrlId &&
			uiID != iNewListCtrlId &&
			uiID != iRecentListCtrlId &&
			!bIsFileList)
		{
			m_lstFDControls.AddTail (pWndChild->GetSafeHwnd ());
		}

		pWndChild = pWndChild->GetNextWindow ();
	}

	m_wndNewList.MoveWindow (rectList);
	m_wndRecentList.MoveWindow (rectList);

	OnTabSelchange();
}
コード例 #8
0
void CBCGPFileDialog::OnInitDone()
{
	const int iBorderWidth = 20;
	const int iBorderHeight = 40;

	CWnd* pFD = GetParent();
	ASSERT (pFD != NULL);

	CRect rectClient;
	pFD->GetClientRect (rectClient);

	int nNewDlgWidth = rectClient.Width () + iBorderWidth * 2 + m_iExtraWidth;

	if (m_pBmpLogo != NULL)
	{
		BITMAP bmp;
		m_pBmpLogo->GetBitmap (&bmp);

		m_rectLogo = CRect (CPoint (max (0, (nNewDlgWidth - bmp.bmWidth) / 2), 8),
							CSize (bmp.bmWidth, bmp.bmHeight));
		m_iLogoAreaHeight = bmp.bmHeight + 20;
	}

	//---------------------------
	// Adjust parent window size:
	//---------------------------
	pFD->ModifyStyle (WS_THICKFRAME, WS_DLGFRAME | WS_BORDER);
	pFD->ModifyStyleEx (WS_EX_WINDOWEDGE, 0);
	pFD->SetWindowPos (NULL, -1, -1, nNewDlgWidth,
					rectClient.Height () + iBorderHeight * 2 + m_iLogoAreaHeight + m_iExtraHeight,
					SWP_NOMOVE | SWP_NOZORDER  | SWP_NOACTIVATE);

	//-------------------
	// Move all controls:
	//-------------------
	CWnd* pWndChild = pFD->GetWindow (GW_CHILD);
	while (pWndChild != NULL)
	{
		CRect rectCtl;
		pWndChild->GetClientRect (rectCtl);
		pWndChild->MapWindowPoints (pFD, rectCtl);
		pWndChild->SetWindowPos (NULL, 
			rectCtl.left + iBorderWidth, 
			rectCtl.top + iBorderHeight + m_iLogoAreaHeight,
			rectCtl.Width (), rectCtl.Height (), 
			SWP_NOZORDER | SWP_NOACTIVATE);

		pWndChild = pWndChild->GetNextWindow ();
	}

	//------------------------------------------
	// Create new and recent file list controls:
	//------------------------------------------
	CRect rectList (0, 0, 0, 0);
	m_wndNewList.Create (WS_VISIBLE | WS_BORDER | WS_TABSTOP | WS_CHILD | LVS_ICON | LVS_AUTOARRANGE | LVS_SINGLESEL, 
							rectList, pFD, iNewListCtrlId);
	m_wndNewList.ModifyStyleEx (0, WS_EX_CLIENTEDGE);

	if (m_pImagesNew != NULL)
	{
		m_wndNewList.SetImageList (m_pImagesNew, LVSIL_NORMAL);
	}

	int i = 0;
	for (POSITION pos = m_lstNewItems.GetHeadPosition (); pos != NULL; i ++)
	{
		CNewItemInfo* pInfo = (CNewItemInfo*) m_lstNewItems.GetNext (pos);
		ASSERT_VALID (pInfo);

		m_wndNewList.InsertItem (i, pInfo->m_strName, pInfo->m_iIconIndex);
	}

	m_wndRecentList.Create (WS_TABSTOP | WS_CHILD | WS_BORDER | LVS_SINGLESEL | LVS_REPORT, 
							rectList, pFD, iRecentListCtrlId);
	m_wndRecentList.ModifyStyleEx (0, WS_EX_CLIENTEDGE);

	m_ImagesRecent.Create (	globalData.m_sizeSmallIcon.cx,
							globalData.m_sizeSmallIcon.cy,
							ILC_COLOR, 0, 10);
	m_wndRecentList.SetImageList (&m_ImagesRecent, LVSIL_SMALL);

	{
		CBCGPLocalResource locaRes;

		CString strFile;
		strFile.LoadString (IDS_BCGBARRES_FILE);
		m_wndRecentList.InsertColumn (0, strFile, LVCFMT_LEFT, 100);

		CString strFolder;
		strFolder.LoadString (IDS_BCGBARRES_FOLDER);
		m_wndRecentList.InsertColumn (1, strFolder);
	}

	CRecentFileList* pMRUFiles = 
		((CBCGApp*) AfxGetApp ())->m_pRecentFileList;

	if (pMRUFiles != NULL)
	{
		TCHAR szCurDir [_MAX_PATH + 1];
		::GetCurrentDirectory (_MAX_PATH, szCurDir);

		int nCurDir = lstrlen (szCurDir);
		ASSERT (nCurDir >= 0);

		szCurDir [nCurDir] = _T('\\');
		szCurDir [++ nCurDir] = _T('\0');

		//---------------
		// Add MRU files:
		//---------------
		int iNumOfFiles = 0;	// Actual added to menu
		for (int i = 0; i < pMRUFiles->GetSize (); i ++)
		{
			CString strFile = (*pMRUFiles) [i];
			if (!strFile.IsEmpty ())
			{
				CString strPath;
				CString strName;
				int iImage = -1;

				int iIndex = strFile.ReverseFind (_T('\\'));
				if (iIndex != -1)
				{
					strPath = strFile.Left (iIndex);
					strName = strFile.Mid (iIndex + 1);
				}
				else
				{
					strName = strFile;
				}

				SHFILEINFO  sfi;
				HIMAGELIST himlSmall = (HIMAGELIST) SHGetFileInfo (strFile,
                                       0,
                                       &sfi, 
                                       sizeof(SHFILEINFO), 
                                       SHGFI_SYSICONINDEX | SHGFI_SMALLICON);

				if (himlSmall != NULL)
				{
					CImageList* pImages = CImageList::FromHandle (himlSmall);
					ASSERT (pImages != NULL);

					HICON hIcon = pImages->ExtractIcon (sfi.iIcon);
					iImage = m_ImagesRecent.Add (hIcon);
					if (hIcon != NULL)
					{
						::DestroyIcon (hIcon);
					}
				}

				iIndex = m_wndRecentList.InsertItem (iNumOfFiles ++, strName, iImage);
				m_wndRecentList.SetItemText (iIndex, 1, strPath);

				int iPathWidth = m_wndRecentList.GetStringWidth (strPath) + 20;
				if (iPathWidth > m_wndRecentList.GetColumnWidth (1))
				{
					m_wndRecentList.SetColumnWidth (1, iPathWidth);
				}
			}
		}
	}

	//---------------------
	// Create tabs control:
	//---------------------
	CRect rectTabs;
	pFD->GetClientRect (rectTabs);
	rectTabs.DeflateRect (4, 4);
	rectTabs.top += m_iLogoAreaHeight;

	m_wndTab.Create (CBCGPTabWnd::STYLE_3D, rectTabs, pFD, iTabCtrlId, 
		CBCGPTabWnd::LOCATION_TOP);
	m_wndTab.m_pParent = this;
	m_wndTab.SetActiveTabBoldFont ();

	m_wndTab.SetFont (GetFont ());
	m_wndTab.SetOwner (this);

	m_wndDummy.Create (_T(""), WS_CHILD, CRect (0, 0, 0, 0), this);

	{
		CBCGPLocalResource locaRes;
		CString strTab;

		if (m_bNewPage)
		{
			m_wndTab.AddTab (&m_wndDummy, IDS_BCGBARRES_NEW_FILE, (UINT)-1, FALSE);
		}

		m_wndTab.AddTab (&m_wndDummy, IDS_BCGBARRES_EXISTING, (UINT)-1, FALSE);
		m_wndTab.AddTab (&m_wndDummy, IDS_BCGBARRES_RECENT, (UINT)-1, FALSE);
	}

	pFD->CenterWindow ();
	pFD->SetWindowText (m_strCaption);

	//------------------
	// Set dilaog icons:
	//------------------
	if (m_hIconSmall != NULL)
	{
		pFD->SetIcon (m_hIconSmall, FALSE);
	}

	if (m_hIconBig != NULL)
	{
		pFD->SetIcon (m_hIconBig, TRUE);
	}

	//--------------------------
	// Setup parent window proc:
	//--------------------------
	m_wndProc = (WNDPROC)SetWindowLongPtr(pFD->m_hWnd, GWLP_WNDPROC, 
		(LONG_PTR) CBCGPFileDialog::WindowProcNew);
}
コード例 #9
0
void CDlgForEach::InitGrid()
{
	CWnd* wndGrid = GetDlgItem(IDC_STATIC_GRID);
	CRect rc;
	wndGrid->GetClientRect (&rc);
	wndGrid->MapWindowPoints (this, &rc);
	wndGrid->ShowWindow(SW_HIDE);
	rc.DeflateRect(1, 1, 1, 1);

	m_forEachGrid.Create (WS_CHILD | WS_VISIBLE | WS_TABSTOP /*| WS_BORDER*/, rc, this, (UINT)-1);
	m_forEachGrid.EnableColumnAutoSize (TRUE);
	m_forEachGrid.SetSingleSel (TRUE);
	m_forEachGrid.EnableGroupByBox (FALSE);
	m_forEachGrid.SetReadOnly (TRUE);
	m_forEachGrid.SetWholeRowSel (TRUE);
	m_forEachGrid.EnableHeader (FALSE);

	//m_forEachGrid.SetWindowPos (&CWnd::wndTop, -1, -1, -1, -1, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);

	//m_forEachGrid.SetScrollBarsStyle(CBCGPScrollBar::BCGP_SBSTYLE_VISUAL_MANAGER);

	//设置颜色
	CBCGPGridColors theme;
	CBCGPVisualManager::GetInstance ()->OnSetGridColorTheme (&m_forEachGrid, theme);
	theme.m_clrBackground = RGB(251, 251, 251);
	theme.m_HeaderSelColors.InitColors();

	m_forEachGrid.SetColorTheme (theme);

	//初始化列
	int nColCount = 1;
	for (int i=0; i<nColCount; i++)
	{
		m_forEachGrid.SetColumnAlign(i, HDF_CENTER);
	}
	m_forEachGrid.AdjustLayout ();

// 	const int nColumns = m_forEachGrid.GetColumnCount ();
// 
// 	m_relatedGrid.RemoveAll();
// 
// 	for(int i = 0; i < nCount; i++)
// 	{
// 		ZTreeParam* pParam = (ZTreeParam*)m_wndGridTree.GetRow(i)->GetData();
// 		if(pParam && pParam->m_pRelatedParam)
// 		{//存在关联
// 			CBCGPGridRow * pRow = NULL;
// 			pRow = m_relatedGrid.CreateRow (nColumns);
// 
// 			pRow->GetItem (COL_NAME1)->SetValue ( (LPCTSTR)pParam->m_strName.c_str() );
// 			CString str = pParam->m_strType.c_str();
// 			str.Replace("Int", "Integer");
// 			pRow->GetItem (COL_TYPE)->SetValue ( str.GetBuffer() );
// 			//pRow->GetItem (COL_TYPE)->SetValue ( (LPCTSTR)pParam->m_strType.c_str() );
// 			pRow->GetItem (COL_NAME2)->SetValue ( (LPCTSTR)pParam->m_pRelatedParam->m_strName.c_str() );
// 			pRow->GetItem (COL_PATH)->SetValue ( (LPCTSTR)pParam->m_pRelatedParam->m_strPath.c_str() );
// 			pRow->SetData((DWORD_PTR)pParam);
// 			//pRow->ReplaceItem(COL_NAME1, new CBCGPGridCheckItem(FALSE));
// 			//m_relatedGrid.getHeader
// 			m_relatedGrid.AddRow (pRow, FALSE);
// 		}
// 	}
// 
// 	for(int i = 0; i < 100; i++)
// 	{
// 		CBCGPGridRow * pRow = NULL;
// 		pRow = m_forEachGrid.CreateRow (nColumns);
// 		CBCGPGridItem* pItem = new CBCGPGrid;
// 		pRow->ReplaceItem(
// 		m_forEachGrid.AddRow()
// 	}
}