示例#1
0
int CReportCtrl::DeleteAllItems(DWORD dwStates)
{
	EndEdit(FALSE);
	int nItemCount = CListCtrl::GetItemCount();
	if (dwStates & RC_ITEM_ALL)
	{
		LockWindowUpdate();
		for (int i = 0; i < nItemCount; i++)
			_FreeItemMemory(i);
		CListCtrl::DeleteAllItems();
		UnlockWindowUpdate();
		return nItemCount;		
	}
	
	int nDelCount = 0;
	LockWindowUpdate();

	for (int i = 0; i < nItemCount; i++)
	{
		if (ExamItemStates(i, dwStates))
		{
			DeleteItem(i--);
			nItemCount--;
			nDelCount++;
		}
	}	
	UnlockWindowUpdate();
	return nDelCount;
}
void CPageAccess::InsertAt( int insert_index )
{
	Test_Spec *spec;
	int inserted_count = 0;
	int global_index = m_LGlobalAccess.GetNextItem( FIND_FIRST, LVNI_SELECTED );

	// find out who is selected: All managers, a manager, or a worker.
	Manager *manager = theApp.pView->m_pWorkerView->GetSelectedManager();
	Worker *worker = theApp.pView->m_pWorkerView->GetSelectedWorker();

	LockWindowUpdate();
	// Loop through all the selected list items from the global list
	// and add them to the assigned list.
	while ( global_index != NOTHING )
	{
		spec = (Test_Spec*)m_LGlobalAccess.GetItemData( global_index );
		switch ( theApp.pView->m_pWorkerView->GetSelectedType() )
		{
		case ALL_MANAGERS:
			// Insert access spec to all managers
			if ( !theApp.manager_list.InsertAccessSpec( spec, 
				insert_index + inserted_count++ ) )
			{
				UnlockWindowUpdate();
				ErrorMessage( "Failed to add the selected access spec to all managers in CPageAccess::Insert()." );
				return;
			}
			break;
		case MANAGER:
			// Insert access spec to a manager
			if ( !manager->InsertAccessSpec( spec,
				insert_index + inserted_count++ ) )
			{
				UnlockWindowUpdate();
				ErrorMessage( "Failed to add the selected access spec to the selected managers in CPageAccess::Insert()." );
				return;
			}
			break;
		case WORKER:
			// Insert acces spec to a worker
			if ( !worker->InsertAccessSpec( spec,
				insert_index + inserted_count++ ) )
			{
				UnlockWindowUpdate();
				ErrorMessage( "Failed to add the selected access spec to the selected worker in CPageAccess::Insert()." );
				return;
			}
			break;
		}
		global_index = m_LGlobalAccess.GetNextItem( global_index, LVNI_SELECTED );
	}
	ShowAssignedAccess();
	UnlockWindowUpdate();
	global_dragging = FALSE;	// Reset global dragging flag.
}
//
// Called by both the up and down button handlers.  This function actually moves the things around
// in both the GUI and the selected assigned's access spec list.
//
void CPageAccess::Move( int desired_index )
{
	Manager *manager;
	Worker *worker;
	int item_index = m_LAssignedAccess.GetNextItem( FIND_FIRST, LVNI_SELECTED );

	// Check to make sure something was selected.
	if ( m_LAssignedAccess.GetSelectedCount() == 0 )
		return;

	LockWindowUpdate();
	// Move the access spec referred to by the selected item.
	switch ( theApp.pView->m_pWorkerView->GetSelectedType() )
	{
	case ALL_MANAGERS:
		theApp.manager_list.MoveAccessSpec( item_index, desired_index );
		break;
	case MANAGER:
		manager = theApp.pView->m_pWorkerView->GetSelectedManager();
		manager->MoveAccessSpec( item_index, desired_index );
		break;
	case WORKER:
		worker = theApp.pView->m_pWorkerView->GetSelectedWorker();
		worker->MoveAccessSpec( item_index, desired_index );
		break;
	}
	ShowAssignedAccess();
	// Select the moved item so that the move buttons are still enabled.
	m_LAssignedAccess.SetItemState( desired_index, LVNI_SELECTED, LVNI_SELECTED );
	UnlockWindowUpdate();
}
void CPageAccess::Delete() 
{
	int item_index = m_LGlobalAccess.GetNextItem( FIND_FIRST, LVNI_SELECTED );

	// Keep track of the first selected item so the highlight
	// will remain on the same index after item removal.
	int new_selected = item_index;

	LockWindowUpdate();
	// Loop through all the selected list items and delete them.
	while ( item_index != NOTHING )
	{
		// Only delete the item if it isn't the idle spec.
		if ( item_index != IDLE_SPEC )
		{
			theApp.access_spec_list.Delete( 
				(Test_Spec*)m_LGlobalAccess.GetItemData( item_index ) );
		}
		item_index = m_LGlobalAccess.GetNextItem( item_index, LVNI_SELECTED );
	}
	// Display the global access specs.
	ShowGlobalAccess();

	// Make sure the item selection won't be beyond the end of the list.
	if ( new_selected >= m_LGlobalAccess.GetItemCount() )
		new_selected = m_LGlobalAccess.GetItemCount() - 1;
	
	// Make a selection in the list.
	m_LGlobalAccess.SetItemState( new_selected, LVNI_SELECTED, LVNI_SELECTED );
	
	// Update the assigned access specs in case we just deleted one.
	ShowAssignedAccess();
	UnlockWindowUpdate();
}
/*--------------------------------------------------------------------
FUNCTION:	OnSelChanged(NMHDR* pNotifyStruct, LRESULT* pResult);
RETURNS:		
PURPOSE:		
--------------------------------------------------------------------*/
void	 CTreePropertySheet::OnSelChanged(
				NMHDR* pNotifyStruct, 
				LRESULT* pResult)
{
	NMTREEVIEW	*pNotify=(NMTREEVIEW*)pNotifyStruct;

	(*pResult)	=0;
	
	int		dwPage=m_cTreeCtrl.GetItemData(pNotify->itemNew.hItem);
	LockWindowUpdate();
  if (GetPageIndex(GetActivePage()) != dwPage)    // NJG
  {
	  /* Theming has these nice fades inbetween controls being disabled and enabled.
	   * That is all nice and well, but switching a page for the _first_ time since
	   * the dialog had been opened causes the dialog controls to be updated in plain
	   * sight - a rather visible and eye-catching affair once you are aware of it.
	   * Updating the dialog controls manually before switching to the active page
	   * causes these updates to be done while the user cannot see it. -JW
	   */
	  GetPage(dwPage)->UpdateDialogControls(this, false);
	  SetActivePage(dwPage);
  }
	UnlockWindowUpdate();

	// Prevent losing the focus when invoked by keyboard
	if(pNotify->action==TVC_BYKEYBOARD)
		m_cTreeCtrl.SetFocus();

  InvalidateRect(NULL, FALSE);  /* invalidate entire control for redraw -JW */
}
示例#6
0
void CEditLogB::Update () 
{
	//LOCK_BLOCK (_lock);

	if (!_init) {
		SetLimitText(_maxLine*1024);
		_init = true;
	}

	int lineCount = GetLineCount ();
	if (_maxLine < lineCount) {
		LockWindowUpdate();

		SetSel (0, LineIndex (lineCount - _maxLine*8/10));
		ReplaceSel ("");

		_textLength = GetWindowTextLength();
		LineScroll(_maxLine, 0);

		UnlockWindowUpdate();
	}

	for (int i=0, n=_logList.size (); i<n; ++i) {
		string &smsg = _logList[i];

		SetSel (_textLength, _textLength);
		ReplaceSel (smsg.c_str ());

		_textLength += smsg.length ();
	}
	_logList.clear ();
}
示例#7
0
//最大窗口
bool CMyFrameWnd::MaxSizeWindow()
{
	//状态判断
	if (m_bMaxShow==false)
	{
		//设置变量
		m_bMaxShow=true;
		m_bRectify=false;

		//默认位置
		GetWindowRect(&m_rcNormalSize);

		//设置按钮
//		m_btMax.SetButtonImage(IDB_BT_RESORE,AfxGetInstanceHandle(),true,false);

		//获取位置
		CRect rcArce;
		SystemParametersInfo(SPI_GETWORKAREA,0,&rcArce,SPIF_SENDCHANGE);

		//移动窗口
		LockWindowUpdate();
		SetWindowPos(NULL,rcArce.left-2,rcArce.top-2,rcArce.Width()+4,rcArce.Height()+4,SWP_NOZORDER);
		UnlockWindowUpdate();
	}

	return true;
}
示例#8
0
//调整界面
void CGameParrentDlg::RectifyControl(int nWidth, int nHeight)
{
	//状态判断
	if (m_bInitDialog==false) return;

	//改对话框要改
	//变量定义
	const int iXExc=0;//GetXExcursionPos();
	const int iYExc=0;//GetYExcursionPos();
	const UINT uFlags=SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOCOPYBITS;

	//锁定屏幕
	LockWindowUpdate();

	//移动控件
	HDWP hDwp=BeginDeferWindowPos(3);
	DeferWindowPos(hDwp,m_pGameFrameView->GetSafeHwnd(),NULL,iXExc,iYExc,nWidth-2*iXExc,nHeight-iYExc,uFlags);
	EndDeferWindowPos(hDwp);

	//重画界面
	Invalidate(FALSE);
	UpdateWindow();

	//解除锁定
	UnlockWindowUpdate();

	return;
}
//最大窗口
bool CGameFrameWnd::MaxSizeWindow()
{
	if(m_bMaxShow==false)
	{
		//设置变量
		m_bMaxShow = true;

		//记录区域
		GetWindowRect(m_rcNormalSize);

		//更新资源
		m_btMax.SetButtonImage(IDB_BT_RESTORE,GetModuleHandle(GAME_FRAME_DLL_NAME),false,false);	
		
		//修改分辨率
		ChangeScreenSetting(MAX_SCREEN_CX,MAX_SCREEN_CY,true);

		//获取位置
		CRect rcArce;
		SystemParametersInfo(SPI_GETWORKAREA,0,&rcArce,SPIF_SENDCHANGE);

		//移动窗口
		LockWindowUpdate();
		SetWindowPos(NULL,rcArce.left-2,rcArce.top-2,rcArce.Width()+4,rcArce.Height()+4,SWP_NOZORDER);
		UnlockWindowUpdate();
	}

	return true;
}
示例#10
0
/**
 * WM_VSCROLL メッセージハンドラ
 * (縦スクロールバーによるスクロール)
 *  ・ちらつきをなくすために裏画面バッファによる描画を行う
 */
void CTouchListCtrl::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
	MZ3_TRACE( L"OnVScroll(%d)\n", nPos );

	// オフセットのズレを調整
	MyAdjustDrawOffset();
	// 慣性スクロール停止
	MyResetAutoScrollTimer();
	
	// スクロール中の描画を禁止
#ifndef WINCE
	LockWindowUpdate();
#endif

	CListCtrl::OnVScroll(nSBCode, nPos, pScrollBar);

	// スクロール中の描画を再開
#ifndef WINCE
	UnlockWindowUpdate();
#endif

#ifndef WINCE
	// Win32では独自処理で描画する
	// => なぜか背景色塗りつぶしになるので標準処理に任せる(ちらつくが仕方ない)
//	DrawBackSurface();
//	UpdateWindow();
#else
	// WMでは処理が追いつかないので標準処理に任せる
	if( !IsScrollWithBk() ){
		// WMで、かつ背景同時スクロールでない場合は遅延再描画
		MySetRedrawTimer( TIMER_INTERVAL_TOUCHLIST_SCROLLREDRAW_L );
	}
#endif
}
示例#11
0
void CGroupStructDlg::OnButtonTo() 
{
	int nCount = m_lstAll.GetSelCount();
	if(nCount > 0)
	{
		CWaitCursor wait;
		LockWindowUpdate();

		nCount = m_lstAll.GetCount();

		for(int i = nCount - 1; i >= 0; i--)
		{
			if(m_lstAll.GetSel(i))
			{
				CString strName;
				m_lstAll.GetText(i, strName);

				CNamesMap::iterator it = m_mapDefSyms.find(strName);
				ASSERT(it != m_mapDefSyms.end());

				m_lstSel.AddString(strName);
				m_lstSel.SetSel(m_lstSel.FindStringExact(-1, strName));
				m_mapCurSyms[strName] = it->second;

				m_lstAll.DeleteString(i);
				m_mapDefSyms.erase(it);
			}
		}

		UnlockWindowUpdate();

		_UpdateButtons();
	}
}
LRESULT CResizableSheetEx::OnResizeSupport(WPARAM wParam, LPARAM lParam)
{
	switch (wParam)
	{
	case RSZSUP_SHEETPAGEEXHACK:
		{
			// a window object must be still associated to the page handle
			// but MFC subclassing has been turned off to allow the system
			// to subclass it first, so we can catch all the messages
			CWnd* pWnd = CWnd::FromHandlePermanent((HWND)lParam);
			if (pWnd == NULL)
				return 0;

			// suclass the window again and refresh page and sheet
			pWnd->SubclassWindow(pWnd->Detach());
			RefreshLayout();
			pWnd->SendMessage(WM_SIZE);
			Invalidate();
			UnlockWindowUpdate();

			if (pWnd->IsWindowVisible())
			{
				// send lost PSN_SETACTIVE notification message
				CPropertyPage* pPage = DYNAMIC_DOWNCAST(CPropertyPage, pWnd);
				if (pPage != NULL)
					SetActivePage(pPage);
			}
		}
		break;

	default:
		return FALSE;
	}
	return TRUE;
}
示例#13
0
BOOL CTreeListCtrl::DeleteAllItems()
{
   LockWindowUpdate();
   BeginWaitCursor();

   MemDeleteAllItems(GetRootItem());
   BOOL m_bReturn = CTreeCtrl::DeleteAllItems();

   EndWaitCursor();
   UnlockWindowUpdate();
   return m_bReturn;
}
示例#14
0
void DialogDeclEditor::OnSize( UINT nType, int cx, int cy ) {
	CRect clientRect, rect;
	LockWindowUpdate();
	CDialog::OnSize( nType, cx, cy );
	GetClientRect( clientRect );
	if( declEdit.GetSafeHwnd() ) {
		rect.left = BORDER_SIZE;
		rect.top = BORDER_SIZE;
		rect.right = clientRect.Width() - BORDER_SIZE;
		rect.bottom = clientRect.Height() - 56;
		declEdit.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() );
	}
	if( testButton.GetSafeHwnd() ) {
		testButton.GetClientRect( rect );
		int width = rect.Width();
		int height = rect.Height();
		rect.left = BORDER_SIZE;
		rect.top = clientRect.Height() - TOOLBAR_HEIGHT - height;
		rect.right = BORDER_SIZE + width;
		rect.bottom = clientRect.Height() - TOOLBAR_HEIGHT;
		testButton.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() );
	}
	if( okButton.GetSafeHwnd() ) {
		okButton.GetClientRect( rect );
		int width = rect.Width();
		int height = rect.Height();
		rect.left = clientRect.Width() - BORDER_SIZE - BUTTON_SPACE - 2 * width;
		rect.top = clientRect.Height() - TOOLBAR_HEIGHT - height;
		rect.right = clientRect.Width() - BORDER_SIZE - BUTTON_SPACE - width;
		rect.bottom = clientRect.Height() - TOOLBAR_HEIGHT;
		okButton.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() );
	}
	if( cancelButton.GetSafeHwnd() ) {
		cancelButton.GetClientRect( rect );
		int width = rect.Width();
		int height = rect.Height();
		rect.left = clientRect.Width() - BORDER_SIZE - width;
		rect.top = clientRect.Height() - TOOLBAR_HEIGHT - height;
		rect.right = clientRect.Width() - BORDER_SIZE;
		rect.bottom = clientRect.Height() - TOOLBAR_HEIGHT;
		cancelButton.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() );
	}
	if( statusBar.GetSafeHwnd() ) {
		rect.left = clientRect.Width() - 2;
		rect.top = clientRect.Height() - 2;
		rect.right = clientRect.Width() - 2;
		rect.bottom = clientRect.Height() - 2;
		statusBar.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() );
	}
	UnlockWindowUpdate();
}
示例#15
0
void CShellWnd::OnRefresh()
{
	CString str;
	if(m_ShellTreeCtrl.GetCurFilePath(str))
	{
		LockWindowUpdate();
		m_fType.GetWindowText(m_ShellTreeCtrl.m_strFilter);
		if(m_ShellTreeCtrl.m_strFilter.Right(1) != ";")
			m_ShellTreeCtrl.m_strFilter += ";";
		m_ShellTreeCtrl.DeleteAllItems();
		m_ShellTreeCtrl.PopulateTree();
		m_ShellTreeCtrl.TunnelTree(str);
		UnlockWindowUpdate();
	}
}
示例#16
0
void CReportCtrl::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	switch (nChar) {
	case VK_NEXT:
	case VK_PRIOR:
		// Don't update window if paging up or down. It looks terrible!
		LockWindowUpdate();
		CListCtrl::OnKeyDown(nChar, nRepCnt, nFlags);
		UnlockWindowUpdate();
		break;
	default:
		CListCtrl::OnKeyDown(nChar, nRepCnt, nFlags);
		break;
	}
}
示例#17
0
void CReportCtrl::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
{
	switch (nSBCode) {
	case SB_PAGEDOWN:
	case SB_PAGEUP:
	case SB_LINEDOWN:
	case SB_LINEUP:
		// Don't update window if paging up or down. It looks terrible!
		LockWindowUpdate();
		CListCtrl::OnVScroll(nSBCode, nPos, pScrollBar);
		UnlockWindowUpdate();
		break;
	default:
		CListCtrl::OnVScroll(nSBCode, nPos, pScrollBar);
		break;
	}
}
示例#18
0
//还原窗口
bool CGameFrame::RestoreWindow()
{
	//状态判断
	if (m_bMaxShow==true)
	{
		//设置按钮
		m_btMax.SetButtonImage(GetPlatformRes().uBtFrameMax,GetResInstanceHandle(),false);

		//移动窗口
		m_bMaxShow=false;
		LockWindowUpdate();
		SetWindowPos(NULL,m_rcNormalSize.left,m_rcNormalSize.top,m_rcNormalSize.Width(),m_rcNormalSize.Height(),SWP_NOZORDER);
		UnlockWindowUpdate();
	}

	return true;
}
示例#19
0
void CSyncDirSet::SetControlPos(int cx, int cy)
{
	const  UINT  uFlags = SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOCOPYBITS | SWP_NOSIZE;

	LockWindowUpdate();

	HDWP hDwp = BeginDeferWindowPos(32);
	CRect rcButton;
	m_btClose.GetWindowRect(&rcButton);
	DeferWindowPos(hDwp, m_btClose, NULL, cx - rcButton.Width() - 2, 0, 0, 0, uFlags);
	EndDeferWindowPos(hDwp);

	Invalidate(FALSE);
	UpdateWindow();

	UnlockWindowUpdate();
}
示例#20
0
//还原窗口
bool CMyFrameWnd::RestoreWindow()
{
	//状态判断
	if (m_bMaxShow==true)
	{
		//设置变量
		m_bMaxShow=false;
		m_bRectify=false;

		//设置按钮
//		m_btMax.SetButtonImage(IDB_BT_MAX,AfxGetInstanceHandle(),true,false);

		//移动窗口
		LockWindowUpdate();
		SetWindowPos(NULL,m_rcNormalSize.left,m_rcNormalSize.top,m_rcNormalSize.Width(),m_rcNormalSize.Height(),SWP_NOZORDER);
		UnlockWindowUpdate();
	}

	return true;
}
//还原窗口
bool CGameFrameWnd::RestoreWindow()
{
	if(m_bMaxShow==true)
	{
		//设置变量
		m_bMaxShow = false;

		//更新资源
		m_btMax.SetButtonImage(IDB_BT_MAX,GetModuleHandle(GAME_FRAME_DLL_NAME),false,false);

		//修改分辨率
		ChangeScreenSetting(m_ScreenMetrics.cx,m_ScreenMetrics.cy,false);

		//移动窗口
		LockWindowUpdate();
		SetWindowPos(NULL,m_rcNormalSize.left,m_rcNormalSize.top,m_rcNormalSize.Width(),m_rcNormalSize.Height(),SWP_NOZORDER);
		UnlockWindowUpdate();
	}

	return true;
}
//****************************************************************************
void CBCGPDialogBar::ScrollClient(const CSize& sizeScroll)
{
	if (sizeScroll == CSize(0, 0) || m_scrollSize == CSize(0, 0))
	{
		return;
	}

	CPoint ptScroll(m_scrollPos);

	ptScroll.x = min (max (ptScroll.x + sizeScroll.cx, 0), m_scrollRange.cx);
	ptScroll.y = min (max (ptScroll.y + sizeScroll.cy, 0), m_scrollRange.cy);

	if (ptScroll == m_scrollPos)
	{
		return;
	}

	LockWindowUpdate ();

	CWnd* pWndChild = GetWindow (GW_CHILD);
	while (pWndChild != NULL)
	{
		CRect rectChild;
		pWndChild->GetWindowRect (rectChild);
		ScreenToClient (rectChild);

		rectChild.OffsetRect (m_scrollPos.x - ptScroll.x, m_scrollPos.y - ptScroll.y);

		pWndChild->SetWindowPos (NULL, rectChild.left, rectChild.top,
			-1, -1, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);

		pWndChild = pWndChild->GetNextWindow ();
	}

	m_scrollPos = ptScroll;

	UnlockWindowUpdate ();

	RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN);
}
示例#23
0
文件: ListCtrlEx.cpp 项目: bugou/test
BOOL CListCtrlEx::SetFullRowSel(BOOL bFullRowSel)
{
	// no painting during change
	LockWindowUpdate();

	m_bFullRowSel = bFullRowSel;

	BOOL bRet;

	if (m_bFullRowSel)
		bRet = ModifyStyle(0L, LVS_OWNERDRAWFIXED);
	else
		bRet = ModifyStyle(LVS_OWNERDRAWFIXED, 0L);

	// repaint window if we are not changing view type
	if (bRet && (GetStyle() & LVS_TYPEMASK) == LVS_REPORT)
		Invalidate();

	// repaint changes
	UnlockWindowUpdate();

	return(bRet);
}
void CInputDocView::updatePanels()
{
#ifndef rbr253
	int i;
	for(i=0; i< m_pEditCtrls.GetSize(); i++)
	{
		// Remember window positions.
		if(m_pEditCtrls[i]->m_hWnd)
			m_iLine[i] = m_pEditCtrls[i]->GetFirstVisibleLine();
	}
#endif // rbr253

	LockWindowUpdate();
	populatePanels();
	UnlockWindowUpdate();

#ifndef rbr253
	for(i=0; i< m_pEditCtrls.GetSize(); i++)
	{
		if(m_pEditCtrls[i]->m_hWnd)
		{
#ifndef hab254
		  int iPos = m_pEditCtrls[i]->GetFirstVisibleLine();
				// following seems to be needed to get
				// some windows to scroll to their proper
				// position; I don't know why...
		  int iCount = m_pEditCtrls[i]->GetLineCount();
		  m_pEditCtrls[i]->LineScroll(m_iLine[i] - iPos);
#else
			// Restore window positions.
			m_pEditCtrls[i]->LineScroll(m_iLine[i]);
#endif // hab254
			m_pEditCtrls[i]->Invalidate();
		}
	}
#endif // rbr253
}
示例#25
0
//最大窗口
bool CGameFrame::MaxSizeWindow()
{
	//状态判断
	if (m_bMaxShow==false)
	{
		//默认位置
		GetWindowRect(&m_rcNormalSize);

		//设置按钮
		m_btMax.SetButtonImage(GetPlatformRes().uBtFrameResore,GetResInstanceHandle(),false);

		//获取位置
		CRect rcArce;
		SystemParametersInfo(SPI_GETWORKAREA,0,&rcArce,SPIF_SENDCHANGE);

		//移动窗口
		m_bMaxShow=true;
		LockWindowUpdate();
		SetWindowPos(NULL,rcArce.left-2,rcArce.top-2,rcArce.Width()+4,rcArce.Height()+4,SWP_NOZORDER);
		UnlockWindowUpdate();
	}

	return true;
}
示例#26
0
void CBaseDialog::OnSize(UINT nType, int cx, int cy)
{
	CSkinDialog::OnSize(nType, cx, cy);

	//移动准备
	HDWP hDwp=BeginDeferWindowPos(64);
	UINT uFlags=SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOZORDER;

	DeferWindowPos(hDwp,m_btClose,NULL,cx-25,25,0,0,uFlags|SWP_NOSIZE);
	DeferWindowPos(hDwp,m_btMax,NULL,cx-50,25,0,0,uFlags|SWP_NOSIZE);
	DeferWindowPos(hDwp,m_btMin,NULL,cx-75,25,0,0,uFlags|SWP_NOSIZE);

	//结束调整
	LockWindowUpdate();
	EndDeferWindowPos(hDwp);
	UnlockWindowUpdate();

	//设置圆角
	CRgn rgn;
	rgn.CreateRoundRectRgn(0,0,cx,cy,4,4);
	SetWindowRgn(rgn,FALSE);

	Invalidate(FALSE);
}
示例#27
0
//调整控件
VOID CMyFrameWnd::RectifyControl(INT nWidth, INT nHeight)
{

	//状态判断
	if ((nWidth==0)||(nHeight==0)) return;

	//移动准备
	HDWP hDwp=BeginDeferWindowPos(64);
	UINT uFlags=SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOZORDER;

	//控制按钮
	DeferWindowPos(hDwp,m_btMin,NULL,nWidth-94,0,0,0,uFlags|SWP_NOSIZE);
	DeferWindowPos(hDwp,m_btMax,NULL,nWidth-66,0,0,0,uFlags|SWP_NOSIZE);
	DeferWindowPos(hDwp,m_btClose,NULL,nWidth-38,0,0,0,uFlags|SWP_NOSIZE);

//	DeferWindowPos(hDwp,m_ServerListView,NULL,0,0,100,100,uFlags);

	//结束调整
	LockWindowUpdate();
	EndDeferWindowPos(hDwp);
	UnlockWindowUpdate();

	return;
}
示例#28
0
//调整界面
void CGameFrameDlg::RectifyControl(int nWidth, int nHeight)
{
	//状态判断
	if (m_bInitDialog==false) return;

	//变量定义
	CRect rcVorSplitter;
	const int nSplitterWidth=6;
	const int iXExc=GetXExcursionPos();
	const int iYExc=GetYExcursionPos();
	const UINT uFlags=SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOCOPYBITS;

	//获取位置
	m_VorSplitter.GetWindowRect(&rcVorSplitter);
	ScreenToClient(&rcVorSplitter);

	//调整拆分条
	if (m_bRectify==false)
	{
		//设置变量
		m_bRectify=true;

		//设置位置
		if (m_bHideList==false)
		{
			rcVorSplitter.left=nWidth*75/100;
			rcVorSplitter.right=rcVorSplitter.left+nSplitterWidth;
		}
		else
		{
			rcVorSplitter.right=nWidth;
			rcVorSplitter.left=nWidth-nSplitterWidth;
		}
	}

	//设置拆分范围
	if (m_bHideList==false)
	{
		int nLessPos=nWidth*3/5,nMaxPos=nWidth*75/100;
		m_VorSplitter.SetSplitterRange(nLessPos,nMaxPos);
		if ((nWidth!=0)&&(nHeight!=0))
		{
			if (rcVorSplitter.left<nLessPos) 
			{
				rcVorSplitter.left=nLessPos;
				rcVorSplitter.right=rcVorSplitter.left+nSplitterWidth;
			}
			if (rcVorSplitter.right>nMaxPos)
			{
				rcVorSplitter.right=nMaxPos;
				rcVorSplitter.left=rcVorSplitter.right-nSplitterWidth;
			}
		}
	}

	if (m_VorSplitter.GetSplitterType()==HorSpliter) rcVorSplitter.SetRect(nWidth,0,nWidth,nHeight);

	//锁定屏幕
	LockWindowUpdate();

	//移动控件
	HDWP hDwp=BeginDeferWindowPos(32);
	DeferWindowPos(hDwp,m_pGameFrameView->GetSafeHwnd(),NULL,iXExc,iYExc,rcVorSplitter.left-iXExc,nHeight-iYExc,uFlags);
	DeferWindowPos(hDwp,m_VorSplitter,NULL,rcVorSplitter.left,iYExc,rcVorSplitter.Width(),nHeight-iYExc,uFlags);
	DeferWindowPos(hDwp,m_pGameFrameControl->GetSafeHwnd(),NULL,rcVorSplitter.right,iYExc,nWidth-rcVorSplitter.right,nHeight-iYExc,uFlags);
	EndDeferWindowPos(hDwp);

	//重画界面
	Invalidate(FALSE);
	UpdateWindow();

	//解除锁定
	UnlockWindowUpdate();

	//控制按钮
	CRect rcControl;
	m_btControl.GetClientRect(&rcControl);
	m_btControl.SetWindowPos(NULL,rcVorSplitter.left+(rcVorSplitter.Width()-rcControl.Width())/2,(nHeight-rcControl.Height())/2,0,0,uFlags|SWP_NOSIZE);

	//设置变量
	m_bRectify=false;

	return;
}
示例#29
0
void DialogDeclBrowser::OnSize( UINT nType, int cx, int cy ) {
	CRect clientRect, rect;

	LockWindowUpdate();

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

	GetClientRect( clientRect );

	if ( declTree.GetSafeHwnd() ) {
		rect.left = BORDER_SIZE;
		rect.top = BORDER_SIZE;
		rect.right = clientRect.Width() - BORDER_SIZE;
		rect.bottom = clientRect.Height() - 100;
		declTree.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() );
	}

	if ( findNameStatic.GetSafeHwnd() ) {
		rect.left = BORDER_SIZE + 2;
		rect.top = clientRect.Height() - 100 + BUTTON_SPACE + 2;
		rect.right = BORDER_SIZE + 80;
		rect.bottom = clientRect.Height() - 76 + 2;
		findNameStatic.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() );
	}

	if ( findTextStatic.GetSafeHwnd() ) {
		rect.left = BORDER_SIZE + 2;
		rect.top = clientRect.Height() - 78 + BUTTON_SPACE + 2;
		rect.right = BORDER_SIZE + 80;
		rect.bottom = clientRect.Height() - 54 + 2;
		findTextStatic.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() );
	}

	if ( findNameEdit.GetSafeHwnd() ) {
		rect.left = BORDER_SIZE + 80;
		rect.top = clientRect.Height() - 100 + BUTTON_SPACE;
		rect.right = clientRect.Width() - BORDER_SIZE;
		rect.bottom = clientRect.Height() - 76;
		findNameEdit.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() );
	}

	if ( findTextEdit.GetSafeHwnd() ) {
		rect.left = BORDER_SIZE + 80;
		rect.top = clientRect.Height() - 78 + BUTTON_SPACE;
		rect.right = clientRect.Width() - BORDER_SIZE;
		rect.bottom = clientRect.Height() - 54;
		findTextEdit.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() );
	}

	if ( findButton.GetSafeHwnd() ) {
		findButton.GetClientRect( rect );
		int width = rect.Width();
		int height = rect.Height();
		rect.left = BORDER_SIZE;
		rect.top = clientRect.Height() - TOOLBAR_HEIGHT - height;
		rect.right = BORDER_SIZE + width;
		rect.bottom = clientRect.Height() - TOOLBAR_HEIGHT;
		findButton.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() );
	}

	if ( editButton.GetSafeHwnd() ) {
		editButton.GetClientRect( rect );
		int width = rect.Width();
		int height = rect.Height();
		rect.left = BORDER_SIZE + BUTTON_SPACE + width;
		rect.top = clientRect.Height() - TOOLBAR_HEIGHT - height;
		rect.right = BORDER_SIZE + BUTTON_SPACE + 2 * width;
		rect.bottom = clientRect.Height() - TOOLBAR_HEIGHT;
		editButton.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() );
	}

	if ( newButton.GetSafeHwnd() ) {
		newButton.GetClientRect( rect );
		int width = rect.Width();
		int height = rect.Height();
		rect.left = BORDER_SIZE + 2 * BUTTON_SPACE + 2 * width;
		rect.top = clientRect.Height() - TOOLBAR_HEIGHT - height;
		rect.right = BORDER_SIZE + 2 * BUTTON_SPACE + 3 * width;
		rect.bottom = clientRect.Height() - TOOLBAR_HEIGHT;
		newButton.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() );
	}

	if ( reloadButton.GetSafeHwnd() ) {
		reloadButton.GetClientRect( rect );
		int width = rect.Width();
		int height = rect.Height();
		rect.left = BORDER_SIZE + 3 * BUTTON_SPACE + 3 * width;
		rect.top = clientRect.Height() - TOOLBAR_HEIGHT - height;
		rect.right = BORDER_SIZE + 3 * BUTTON_SPACE + 4 * width;
		rect.bottom = clientRect.Height() - TOOLBAR_HEIGHT;
		reloadButton.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() );
	}

	if ( cancelButton.GetSafeHwnd() ) {
		cancelButton.GetClientRect( rect );
		int width = rect.Width();
		int height = rect.Height();
		rect.left = clientRect.Width() - BORDER_SIZE - width;
		rect.top = clientRect.Height() - TOOLBAR_HEIGHT - height;
		rect.right = clientRect.Width() - BORDER_SIZE;
		rect.bottom = clientRect.Height() - TOOLBAR_HEIGHT;
		cancelButton.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() );
	}

	if ( statusBar.GetSafeHwnd() ) {
		rect.left = clientRect.Width() - 2;
		rect.top = clientRect.Height() - 2;
		rect.right = clientRect.Width() - 2;
		rect.bottom = clientRect.Height() - 2;
		statusBar.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() );
	}

	UnlockWindowUpdate();
}
示例#30
0
//调整界面
void CGameFrameDlg::RectifyControl(int nWidth, int nHeight)
{
	CString strFile,strTemp;
	CTime tmCur = CTime::GetCurrentTime();
	CString strTime = tmCur.Format("%m%d");
	strFile.Format("log\\%sRectifyControl.log",strTime);

	strTemp.Format("RectifyControl nWidth=%d  nHeight=%d", nWidth,  nHeight);
	WriteLog(strFile, strTemp);

	//状态判断
	if (m_bInitDialog==false) return;

	//变量定义
	CRect rcVorSplitter;
	const int nSplitterWidth=0;
	const int iXExc=GetXExcursionPos();
	const int iYExc=GetYExcursionPos();
	//	const UINT uFlags=SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOCOPYBITS;

	//获取位置
	m_VorSplitter.GetWindowRect(&rcVorSplitter);
	int addInt = 50;//左移50
	//移动控件
	int iBaseXPos=rcVorSplitter.right;//左边最大值

	ScreenToClient(&rcVorSplitter);

	//调整拆分条
	if (m_bRectify==false)
	{
		m_bRectify=true;
		rcVorSplitter.left=nWidth*72/100;
		rcVorSplitter.right=rcVorSplitter.left+nSplitterWidth;
	}

	//设置拆分范围
	/*Doctor
	int nLessPos=nWidth*3/5,nMaxPos=nWidth*75/100;
	m_VorSplitter.SetSplitterRange(nLessPos,nMaxPos);
	if ((nWidth!=0)&&(nHeight!=0))
	{
	if (rcVorSplitter.left<nLessPos) 
	{
	rcVorSplitter.left=nLessPos;
	rcVorSplitter.right=rcVorSplitter.left+nSplitterWidth;
	}
	if (rcVorSplitter.right>nMaxPos)
	{
	rcVorSplitter.right=nMaxPos;
	rcVorSplitter.left=rcVorSplitter.right-nSplitterWidth;
	}
	}
	*/
	//锁定屏幕
	LockWindowUpdate();

	//移动控件
	HDWP hDwp=BeginDeferWindowPos(32);
	DeferWindowPos(hDwp,m_pGameFrameView->GetSafeHwnd(),NULL,iXExc,iYExc,rcVorSplitter.left-iXExc,nHeight-iYExc,uFlags);
	DeferWindowPos(hDwp,m_VorSplitter,NULL,rcVorSplitter.left,iYExc,rcVorSplitter.Width(),nHeight-iYExc,uFlags);
	DeferWindowPos(hDwp,m_pGameFrameControl->GetSafeHwnd(),NULL,rcVorSplitter.right,iYExc,nWidth-rcVorSplitter.right,nHeight-iYExc,uFlags);


	//隐藏按钮  iBaseXPos-SPLIT_WIDE+addInt
	//功能按钮
	CRect rcButton;
	int nYPosButton=nHeight-30;
	int nBeginPos=nWidth-220,nButtonSpace=0;
	m_btGameOption.GetWindowRect(&rcButton);

	int myLeftInt,myLeftInt1, myLeftInt2;
	int btnW = 24;
	int btnW1 = 20;
	int btnW2 = rcButton.Width();

	if ( (nWidth-iBaseXPos) > 100)
	{
		myLeftInt = rcVorSplitter.right- btnW;//-SPLIT_WIDE+addInt;//展开
		myLeftInt1 =rcVorSplitter.right- btnW1 ;
		myLeftInt2 = rcVorSplitter.right- btnW2;//iBaseXPos- btnW2 ;
	}
	else
	{
		myLeftInt =rcVorSplitter.right- btnW ;
		myLeftInt1 =rcVorSplitter.right- btnW1 ;
		myLeftInt2 = rcVorSplitter.right- btnW2 ;//iBaseXPos- btnW2 ;
	}

	//	DeferWindowPos(hDwp,m_BtHideList,NULL,myLeftInt,TITLE_HIGHT,9,iHeight,uFlags);
	//	DeferWindowPos(hDwp,m_BtHideList,NULL,myLeftInt,TITLE_HIGHT,0,0,uFlags);
	strTemp.Format("m_BtHideList %d  %d iBaseXPos=%d", myLeftInt,  TITLE_HIGHT, iBaseXPos);
	WriteLog(strFile, strTemp);
	m_BtHideList.MoveWindow( myLeftInt, 180+TITLE_HIGHT,  btnW, 69);
	m_BtYuYin.MoveWindow(myLeftInt1, 275+TITLE_HIGHT, btnW1, 92);

	showDlgX=myLeftInt - 265;
	showDlgY=275 - 377/2;

	int ctrlXInt = myLeftInt2;

	int ctrlYInt = 20+TITLE_HIGHT;
	DeferWindowPos(hDwp,m_btGameRule,NULL, ctrlXInt, ctrlYInt,rcButton.Width(),rcButton.Height(),uFlags);

	ctrlYInt = 60+TITLE_HIGHT;
	DeferWindowPos(hDwp,m_btGameOption,NULL, ctrlXInt, ctrlYInt,rcButton.Width(),rcButton.Height(),uFlags);


	EndDeferWindowPos(hDwp);

	//重画界面
	Invalidate(FALSE);
	UpdateWindow();

	//解除锁定
	UnlockWindowUpdate();

	return;
}