コード例 #1
0
void CMainFrame::ShowEditWnd(CClipIDs &Ids)
{
    CWaitCursor wait;

    bool bCreatedWindow = false;
    if(m_pEditFrameWnd == NULL)
    {
        m_pEditFrameWnd = new CEditFrameWnd;
        m_pEditFrameWnd->LoadFrame(IDR_MAINFRAME);
        bCreatedWindow = true;
    }
    if(m_pEditFrameWnd)
    {
        m_pEditFrameWnd->EditIds(Ids);
        m_pEditFrameWnd->SetNotifyWnd(m_hWnd);

        if(bCreatedWindow)
        {
            CSize sz;
            CPoint pt;
            CGetSetOptions::GetEditWndSize(sz);
            CGetSetOptions::GetEditWndPoint(pt);
            CRect cr(pt, sz);
            EnsureWindowVisible(&cr);
            m_pEditFrameWnd->MoveWindow(cr);
        }

        m_pEditFrameWnd->ShowWindow(SW_SHOW);
        m_pEditFrameWnd->SetForegroundWindow();
        m_pEditFrameWnd->SetFocus();
    }
}
コード例 #2
0
BOOL CToolTipCtrlX::OnTTShow(NMHDR *pNMHDR, LRESULT *pResult)
{
	//DebugLog(_T("OnTTShow: rcScreen: %d,%d-%d,%d: styles=%08x  exStyles=%08x"), m_rcScreen, GetStyle(), GetWindowLong(m_hWnd, GWL_EXSTYLE));

	// Win98/Win2000: The only chance to resize a tooltip window is to do it within the TTN_SHOW notification.
	if (theApp.m_ullComCtrlVer <= MAKEDLLVERULL(5,81,0,0))
	{
		NMTTCUSTOMDRAW nmttcd = {0};
		nmttcd.uDrawFlags = DT_NOPREFIX | DT_CALCRECT | DT_EXTERNALLEADING | DT_EXPANDTABS | DT_WORDBREAK;
		nmttcd.nmcd.hdr = *pNMHDR;
		nmttcd.nmcd.dwDrawStage = CDDS_PREPAINT;
		nmttcd.nmcd.hdc = ::GetDC(pNMHDR->hwndFrom);
		CustomPaint(&nmttcd);
		::ReleaseDC(pNMHDR->hwndFrom, nmttcd.nmcd.hdc);

		CRect rcWnd(nmttcd.nmcd.rc);
		AdjustRect(&rcWnd);

		// Win98/Win2000: We have to explicitly ensure that the tooltip window remains within the visible desktop window.
		EnsureWindowVisible(m_rcScreen, rcWnd);

		// Win98/Win2000: The only chance to resize a tooltip window is to do it within the TTN_SHOW notification.
		// Win98/Win2000: Must *not* specify 'SWP_NOZORDER' - some of the tooltip windows may get drawn behind(!) the application window!
		::SetWindowPos(pNMHDR->hwndFrom, NULL, rcWnd.left, rcWnd.top, rcWnd.Width(), rcWnd.Height(), SWP_NOACTIVATE /*| SWP_NOZORDER*/);

		*pResult = TRUE; // Windows API: Suppress default positioning
		return TRUE;	 // MFC API:     Suppress further routing of this message
	}

	// If the TTN_SHOW notification is not sent to the subclassed tooltip control, we would loose the
	// exact positioning of in-place tooltips which is performed by the tooltip control by default.
	// Thus it is important that we tell MFC (not the Windows API in that case) to further route this message.
	*pResult = FALSE;	// Windows API: Perform default positioning
	return FALSE;		// MFC API.     Perform further routing of this message (to the subclassed tooltip control)
}
コード例 #3
0
ファイル: ViewWindow.cpp プロジェクト: am11/ffcore
void ff::ViewWindow::LayoutChildren()
{
#if !METRO_APP
	RectInt clientRect = GetClientRect(Handle());
	HWND target = GetChildWindow();

	if (target != nullptr)
	{
		EnsureWindowParent(target, Handle());
		MoveWindow(target, clientRect);
		EnsureWindowVisible(target, true);
	}
#endif
}
コード例 #4
0
ファイル: ToolTipEx.cpp プロジェクト: svn2github/ditto-cp
BOOL CToolTipEx::Show(CPoint point)
{
	m_reducedWindowSize = false;
    if(m_pBitmap)
    {
        m_RichEdit.ShowWindow(SW_HIDE);
    }
    else
    {
        m_RichEdit.ShowWindow(SW_SHOW);
    }

	CRect rect;

	if(CGetSetOptions::GetSizeDescWindowToContent() == FALSE)
	{
		rect.left = point.x;
		rect.top = point.y;
		CSize size;
		CGetSetOptions::GetDescWndSize(size);
		rect.right = rect.left + size.cx;
		rect.bottom = rect.top + size.cy;

		EnsureWindowVisible(&rect);
	}
	else
	{
		rect = GetBoundsRect();

		//account for the scroll bars
		rect.right += 20;
		rect.bottom += 20;

		if (m_pBitmap)
		{
			int nWidth = CBitmapHelper::GetCBitmapWidth(*m_pBitmap);
			int nHeight = CBitmapHelper::GetCBitmapHeight(*m_pBitmap);

			rect.right = rect.left + nWidth;
			rect.bottom = rect.top + nHeight;
		}
		else if(m_csRTF != "")
		{
			//if showing rtf then increase the size because
			//rtf will probably draw bigger
			long lNewWidth = (long)rect.Width() + (long)(rect.Width() *1.5);
			rect.right = rect.left + lNewWidth;

			long lNewHeight = (long)rect.Height() + (long)(rect.Height() *1.5);
			rect.bottom = rect.top + lNewHeight;
		}

		rect.right += CAPTION_BORDER * 2;
		rect.bottom += CAPTION_BORDER * 2;

		

		CRect rcScreen;

		ClientToScreen(rect);

		CRect cr(point, point);

		int nMonitor = GetMonitorFromRect(&cr);
		GetMonitorRect(nMonitor, &rcScreen);

		//ensure that we don't go outside the screen
		if(point.x < 0)
		{
			point.x = 5;
			m_reducedWindowSize = true;
		}
		if(point.y < 0)
		{
			point.y = 5;
			m_reducedWindowSize = true;
		}

		rcScreen.DeflateRect(0, 0, 5, 5);

		long lWidth = rect.Width();
		long lHeight = rect.Height();

		rect.left = point.x;
		rect.top = point.y;
		rect.right = rect.left + lWidth;
		rect.bottom = rect.top + lHeight;
		
		if (rect.right > rcScreen.right)
		{
			rect.right = rcScreen.right;
			m_reducedWindowSize = true;
		}
		if (rect.bottom > rcScreen.bottom)
		{
			rect.bottom = rcScreen.bottom;
			m_reducedWindowSize = true;
		}
	}

    SetWindowPos(&CWnd::wndTopMost, rect.left, rect.top, rect.Width(), rect.Height
                 (), SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_NOACTIVATE |
                 SWP_NOZORDER);

    return TRUE;
}