Esempio n. 1
0
void CResizableDialog::OnSize(UINT nType, int cx, int cy)
{
    CWnd::OnSize(nType, cx, cy);

    if (nType == SIZE_MAXHIDE || nType == SIZE_MAXSHOW)
        return;     // arrangement not needed

    if ((m_bShowGrip)||(!IsDwmCompositionEnabled()))
    {
        if (nType == SIZE_MAXIMIZED)
            HideSizeGrip(&m_dwGripTempState);
        else
            ShowSizeGrip(&m_dwGripTempState);
        // update grip and layout
        UpdateSizeGrip();
    }
    if (IsDwmCompositionEnabled())
        HideGrip();

    ArrangeLayout();
    // on Vista, the redrawing doesn't work right, so we have to work
    // around this by invalidating the whole dialog so the DWM recognizes
    // that it has to update the application window.
        Invalidate();
}
Esempio n. 2
0
void CResizableDialog::OnSize(UINT nType, int cx, int cy) 
{
	CWnd::OnSize(nType, cx, cy);
	
	if (nType == SIZE_MAXHIDE || nType == SIZE_MAXSHOW)
		return;		// arrangement not needed

	if (nType == SIZE_MAXIMIZED)
		HideSizeGrip(&m_dwGripTempState);
	else
		ShowSizeGrip(&m_dwGripTempState);

	// update grip and layout
	UpdateSizeGrip();
	ArrangeLayout();
}
Esempio n. 3
0
void CResizableFormView::OnSize(UINT nType, int cx, int cy) 
{
	CFormView::OnSize(nType, cx, cy);

	const CWnd* pParent = GetParentFrame();

	// hide size grip when parent is maximized
	if (pParent->IsZoomed())
		HideSizeGrip(&m_dwGripTempState, GHR_MAXIMIZED);
	else
		ShowSizeGrip(&m_dwGripTempState, GHR_MAXIMIZED);

	// hide size grip when there are scrollbars
	const CSize size = GetTotalSize();
	if ((cx < size.cx || cy < size.cy) && (m_nMapMode >= 0))
		HideSizeGrip(&m_dwGripTempState, GHR_SCROLLBAR);
	else
		ShowSizeGrip(&m_dwGripTempState, GHR_SCROLLBAR);

	// hide size grip when the parent frame window is not resizable
	// or the form is not bottom-right aligned (e.g. there's a statusbar)
	const DWORD dwStyle = pParent->GetStyle();
	CRect rect, rectChild;
	GetWindowRect(rect);

	BOOL bCanResize = TRUE; // whether the grip can size the frame
	for (HWND hWndChild = ::GetWindow(m_hWnd, GW_HWNDFIRST); hWndChild != NULL;
		hWndChild = ::GetNextWindow(hWndChild, GW_HWNDNEXT))
	{
		::GetWindowRect(hWndChild, rectChild);
		//! @todo check RTL layouts!
		if (rectChild.right > rect.right || rectChild.bottom > rect.bottom)
		{
			bCanResize = FALSE;
			break;
		}
	}
	if ((dwStyle & WS_THICKFRAME) && bCanResize)
		ShowSizeGrip(&m_dwGripTempState, GHR_ALIGNMENT);
	else
		HideSizeGrip(&m_dwGripTempState, GHR_ALIGNMENT);

	// update grip and layout
	UpdateSizeGrip();
	ArrangeLayout();
}
Esempio n. 4
0
BOOL CResizableGrip::CreateSizeGrip(BOOL bVisible /*= TRUE*/,
		BOOL bTriangular /*= TRUE*/, BOOL bTransparent /*= FALSE*/)
{
	// create grip
	CRect rect(0 , 0, m_wndGrip.m_size.cx, m_wndGrip.m_size.cy);
	BOOL bRet = m_wndGrip.Create(WS_CHILD | WS_CLIPSIBLINGS
		| SBS_SIZEGRIP, rect, GetResizableWnd(), 0);

	if (bRet)
	{
		// set options
		m_wndGrip.SetTriangularShape(bTriangular);
		m_wndGrip.SetTransparency(bTransparent);
		SetSizeGripVisibility(bVisible);
	
		// update position
		UpdateSizeGrip();
	}

	return bRet;
}
Esempio n. 5
0
// CDlgDebuger message handlers
BOOL CDlgDebuger::OnInitDialog()
{
	CResizableDialog::OnInitDialog();

	// TODO: 在此添加额外的初始化代码
	AddAnchor(IDC_TAB_MAIN, TOP_LEFT, BOTTOM_RIGHT);

	//屏蔽关闭按钮
	GetSystemMenu(FALSE)->EnableMenuItem(SC_CLOSE, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);

	// get desktop size
	CRect rc;
	SystemParametersInfo(SPI_GETWORKAREA, NULL, &rc, NULL);
	rc.right = 256;
	SetMaximizedRect(rc);
	
	CRect rect;
	GetClientRect(&rect);
	MoveWindow(10, 150, rect.Width(), rect.Height(), TRUE);
	
	SetSizeGripVisibility(FALSE);
	UpdateSizeGrip();

	//创建字窗口
	CreateSubWindow();

	//Hook
	CCaptionButton::InitCapBtn(g_pGfxSystem->GetWindow());
	m_pCaptionBtn->SetBmpID(1, IDB_BITMAP_LAMPON, IDB_BITMAP_LAMPOFF, TRUE);
	m_pCaptionBtn->ChangeButtonState();

	::SetActiveWindow(g_pGfxSystem->GetWindow());

	m_pCaptionBtn->ChangeButtonState();

	return TRUE;  // 除非设置了控件的焦点,否则返回 TRUE
}
void CResizableSheetEx::OnSize(UINT nType, int cx, int cy) 
{
	CWnd::OnSize(nType, cx, cy);
	
	if (nType == SIZE_MAXHIDE || nType == SIZE_MAXSHOW)
		return;		// arrangement not needed

	if (nType == SIZE_MAXIMIZED)
		HideSizeGrip(&m_dwGripTempState);
	else
		ShowSizeGrip(&m_dwGripTempState);

	// update grip and layout
	UpdateSizeGrip();
	ArrangeLayout();

	if (IsWizard97())
	{
		// refresh header area
		CRect rect;
		GetHeaderRect(rect);
		InvalidateRect(rect, FALSE);
	}
}
Esempio n. 7
0
void CResizableFormView::OnSize(UINT nType, int cx, int cy) 
{
	CFormView::OnSize(nType, cx, cy);

	CWnd* pParent = GetParent();

	// hide zise grip when parent is maximized
	if (pParent->IsZoomed())
		HideSizeGrip(&m_dwGripTempState, GHR_MAXIMIZED);
	else
		ShowSizeGrip(&m_dwGripTempState, GHR_MAXIMIZED);

	// hide size grip when there are scrollbars
	CSize size = GetTotalSize();
	if (cx < size.cx || cy < size.cy)
		HideSizeGrip(&m_dwGripTempState, GHR_SCROLLBAR);
	else
		ShowSizeGrip(&m_dwGripTempState, GHR_SCROLLBAR);

	// hide size grip when the parent window is not resizable
	// or the form is not bottom-right aligned (e.g. there's a statusbar)
	DWORD dwStyle = pParent->GetStyle();
	CRect rectParent, rectChild;
	GetWindowRect(rectChild);
	::MapWindowPoints(NULL, pParent->GetSafeHwnd(), (LPPOINT)&rectChild, 2);
	pParent->GetClientRect(rectParent);
	if (!(dwStyle & WS_THICKFRAME)
		|| (rectChild.BottomRight() != rectParent.BottomRight()))
		HideSizeGrip(&m_dwGripTempState, GHR_ALIGNMENT);
	else
		ShowSizeGrip(&m_dwGripTempState, GHR_ALIGNMENT);

	// update grip and layout
	UpdateSizeGrip();
	ArrangeLayout();
}
Esempio n. 8
0
void CDemoDlg::OnRadio2() 
{
 	ShowSizeGrip(&m_dwGripTempState);
	UpdateSizeGrip();
}
Esempio n. 9
0
void CDemoDlg::OnRadio1() 
{
	HideSizeGrip(&m_dwGripTempState);
	UpdateSizeGrip();
}