Example #1
0
static void GetCenterRect( CRect &rc )
{
	CSize scr = GetScreenSize( );
	int left  = ( scr.cx - rc.Width() ) / 2;
	int top   = ( scr.cy - rc.Height() ) / 2;
	rc.OffsetRect( left, top );
}
/****************************************************
*	Create(DWORD dwStyle, const CRect& rect, CWnd* pParent, nID)
*	Use this function instead of the CStatic::Create function
* Parameters: No need to explain (see MSDN (:-) )
*
****************************************************/
void CSplitterControl::Create(DWORD dwStyle, const CRect &rect, CWnd *pParent, UINT nID)
{
	CRect rc = rect;
	dwStyle |= SS_NOTIFY;
	
	// Determine default type base on it's size.
	m_nType = (rc.Width() < rc.Height())?
					SPS_VERTICAL:
					SPS_HORIZONTAL;
	
	if (m_nType == SPS_VERTICAL)
		rc.right = rc.left + 5;
	else // SPS_HORIZONTAL
		rc.bottom = rc.top + 5;
	
	CStatic::Create("", dwStyle, rc, pParent, nID);
	
	if (!SplitterControl_hCursor1)
	{
		SplitterControl_hCursor1 = AfxGetApp()->LoadStandardCursor(IDC_SIZEWE);
		SplitterControl_hCursor2 = AfxGetApp()->LoadStandardCursor(IDC_SIZENS);
	}
	
	// force the splitter not to be splited.
	SetRange(0, 0, -1);
}
Example #3
0
void SubPlotWnd::OnMouseMove(UINT nFlags, CPoint point)
{
	// TODO: Add your message handler code here and/or call default
	if (this->isDraging)
	{
		CPoint cursorPoint;
		::GetCursorPos(&cursorPoint);
		CPoint cursorPointOld = cursorPoint;

		CRect parentClientRect;
		this->GetParent()->GetClientRect(&parentClientRect);
		this->GetParent()->ClientToScreen(&parentClientRect);

		cursorPoint.x = max(cursorPoint.x, parentClientRect.left);
		cursorPoint.x = min(cursorPoint.x, parentClientRect.right);
		cursorPoint.y = max(cursorPoint.y, parentClientRect.top);
		cursorPoint.y = min(cursorPoint.y, parentClientRect.bottom);

		if (cursorPoint != cursorPointOld)
			::SetCursorPos(cursorPoint.x, cursorPoint.y);
		CRect rectWindow = this->rectBeforeDrag;
		rectWindow.OffsetRect(cursorPoint - this->cursorBeforeDrag);
		this->MoveWindow(rectWindow.left, rectWindow.top, rectWindow.Width(), rectWindow.Height(), 1);

		CWnd::OnMouseMove(nFlags, point);
	}
}
Example #4
0
int MeetingManagerView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CView::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// TODO: Add your specialized creation code here
	CDrawLotsManagerDoc* drawDoc = (CDrawLotsManagerDoc*)this->GetDocument();
	meetingID = drawDoc->l_Meeting_ID;
	meetingName = drawDoc->str_Meeting_Name;
	GetParentFrame()->SetWindowText(meetingName);

	CRect rc;  
    GetWindowRect(&rc);  

	VERIFY(m_wndSplitter.CreateStatic(this, 1, 2, WS_CHILD | WS_VISIBLE)); 	
	CCreateContext *pContext = (CCreateContext*) lpCreateStruct->lpCreateParams;
	
	m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(MatchView), CSize(300, rc.Height()), pContext);	
	m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(MatchOrgAthView), CSize(0, rc.Height()), pContext);
	MatchView* pViewRes = (MatchView*)m_wndSplitter.GetPane(0,0);
	pViewRes->meetingID = drawDoc->l_Meeting_ID;
	pViewRes->rightView = (MatchOrgAthView*)m_wndSplitter.GetPane(0,1);
	m_wndSplitter.MoveWindow(0, 0, rc.Width(), rc.Height());
	
	return 0;
}
Example #5
0
BOOL CSizingControlBar::GetEdgeRect(CRect rcWnd, UINT nHitTest,
                                    CRect& rcEdge)
{
    rcEdge = rcWnd;
    if (m_dwSCBStyle & SCBS_SHOWEDGES)
        rcEdge.DeflateRect(1, 1);
    BOOL bHorz = IsHorzDocked();

    switch (nHitTest)
    {
    case HTLEFT:
        if (!(m_dwSCBStyle & SCBS_EDGELEFT)) return FALSE;
        rcEdge.right = rcEdge.left + m_cxEdge;
        rcEdge.DeflateRect(0, bHorz ? m_cxEdge: 0);
        break;
    case HTTOP:
        if (!(m_dwSCBStyle & SCBS_EDGETOP)) return FALSE;
        rcEdge.bottom = rcEdge.top + m_cxEdge;
        rcEdge.DeflateRect(bHorz ? 0 : m_cxEdge, 0);
        break;
    case HTRIGHT:
        if (!(m_dwSCBStyle & SCBS_EDGERIGHT)) return FALSE;
        rcEdge.left = rcEdge.right - m_cxEdge;
        rcEdge.DeflateRect(0, bHorz ? m_cxEdge: 0);
        break;
    case HTBOTTOM:
        if (!(m_dwSCBStyle & SCBS_EDGEBOTTOM)) return FALSE;
        rcEdge.top = rcEdge.bottom - m_cxEdge;
        rcEdge.DeflateRect(bHorz ? 0 : m_cxEdge, 0);
        break;
    default:
        ASSERT(FALSE); // invalid hit test code
    }
    return TRUE;
}
Example #6
0
void CCheckStatic::SetCheck(BOOL check)
{
	m_Check.SetCheck(check);

	if (m_ItemID.GetSize() > 0)
	{
		for (int i = 0; i < m_ItemID.GetSize(); i++)
			GetParent()->GetDlgItem(m_ItemID[i])->EnableWindow(check);
	}
	else
	{
		for (int i = 0; i < m_IDList.GetSize(); i++)
		{
			CWnd * pWnd = GetParent()->GetDlgItem(m_IDList[i]);
			
			// We grab the rect of the item, put it into client co-ord's and only modify items inside our static box
			CRect rc;
			
			pWnd->GetWindowRect(&rc);
			ScreenToClient(&rc);
			
			if (m_rcStatic.PtInRect(rc.TopLeft()) && m_rcStatic.PtInRect(rc.BottomRight()))
				pWnd->EnableWindow(check);
		}
	}
}
Example #7
0
LRESULT LocationsPage::onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	PropPage::translate((HWND)(*this), texts);
	PropPage::read((HWND)*this, items);
	ctrlDirectories.Attach(GetDlgItem(IDC_FAVORITE_DIRECTORIES));
	ctrlDirectories.SetExtendedListViewStyle(LVS_EX_LABELTIP | LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER);
		
	// Prepare shared dir list
	CRect rc; 
	ctrlDirectories.GetClientRect(rc); 
	ctrlDirectories.InsertColumn(0, CTSTRING(FAVORITE_DIR_NAME), LVCFMT_LEFT, rc.Width()/4, 0); 
	ctrlDirectories.InsertColumn(1, CTSTRING(PATHS), LVCFMT_LEFT, rc.Width()*2 /2, 1);
	favoriteDirs = FavoriteManager::getInstance()->getFavoriteDirs();
	for(auto j = favoriteDirs.begin(); j != favoriteDirs.end(); j++) {
		int i = ctrlDirectories.insert(ctrlDirectories.GetItemCount(), Text::toT(j->first).c_str());
		ctrlDirectories.SetItemText(i, 1, Text::toT(Util::listToString(j->second)).c_str());
	}

	ctrlAutoSelect.Attach(GetDlgItem(IDC_AUTOPATH_METHOD));
	ctrlAutoSelect.AddString(CTSTRING(AUTOSELECT_MOST_SPACE));
	ctrlAutoSelect.AddString(CTSTRING(AUTOSELECT_LEAST_SPACE));
	ctrlAutoSelect.SetCurSel(SETTING(DL_AUTOSELECT_METHOD));
	fixControls();
	return TRUE;
}
LRESULT AVIPreview::onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	PropPage::translate((HWND)(*this), texts);
	
	CRect rc;
	
	ctrlCommands.Attach(GetDlgItem(IDC_MENU_ITEMS));
	ctrlCommands.GetClientRect(rc);
	
	ctrlCommands.InsertColumn(0, CTSTRING(SETTINGS_NAME), LVCFMT_LEFT, rc.Width() / 5, 0);
	ctrlCommands.InsertColumn(1, CTSTRING(SETTINGS_COMMAND), LVCFMT_LEFT, rc.Width() * 2 / 5, 1);
	ctrlCommands.InsertColumn(2, CTSTRING(SETTINGS_ARGUMENT), LVCFMT_LEFT, rc.Width() / 5, 2);
	ctrlCommands.InsertColumn(3, CTSTRING(SETTINGS_EXTENSIONS), LVCFMT_LEFT, rc.Width() / 5, 3);
	
	SET_EXTENDENT_LIST_VIEW_STYLE(ctrlCommands);
	SET_LIST_COLOR_IN_SETTING(ctrlCommands);
	
	// Do specialized reading here
	const PreviewApplication::List lst = FavoriteManager::getInstance()->getPreviewApps();
	auto cnt = ctrlCommands.GetItemCount();
	for (auto i = lst.cbegin(); i != lst.cend(); ++i)
	{
		PreviewApplication::Ptr pa = *i;
		addEntry(pa, cnt++);
	}
	return 0;
}
Example #9
0
//左视图区
void CGameFrameControl::DrawLeftViewFrame(CDC * pDC)
{
    //获取位置
    CRect rcClient;
    GetClientRect(&rcClient);

    //变量定义
    HDC hDC=pDC->m_hDC;
    int nXPos=0,nYPos=0;
    int nComminutePos=rcClient.Height()*4/8;

    //绘画聊框
    CRect rcChat;
    rcChat.left=0;
    rcChat.right=rcClient.Width();
    rcChat.top=nComminutePos;
    rcChat.bottom=rcClient.Height();
    CSkinAide::DrawEncircleFrame(pDC,rcChat,m_EncircleChat);

    //绘画列表
    CRect rcList;
    rcList.left=0;
    rcList.right=rcClient.Width();
    rcList.top=0;
    rcList.bottom=nComminutePos;
    CSkinAide::DrawEncircleFrame(pDC,rcList,m_EncircleList);

    return;
}
Example #10
0
void CHistoryCombo::OnTimer(UINT_PTR nIDEvent)
{
    CPoint point;
    DWORD ptW = GetMessagePos();
    point.x = GET_X_LPARAM(ptW);
    point.y = GET_Y_LPARAM(ptW);
    ScreenToClient(&point);

    CRect rectClient;
    GetClientRect(&rectClient);
    int nComboButtonWidth = ::GetSystemMetrics(SM_CXHTHUMB) + 2;

    rectClient.right = rectClient.right - nComboButtonWidth;

    if (!rectClient.PtInRect(point))
    {
        KillTimer(nIDEvent);
        ::SendMessage(m_hWndToolTip, TTM_TRACKACTIVATE, FALSE, (LPARAM)(LPTOOLINFO) &m_ToolInfo);
        m_ttShown = FALSE;
    }
    if (nIDEvent == 2)
    {
        // tooltip timeout, just deactivate it
        ::SendMessage(m_hWndToolTip, TTM_TRACKACTIVATE, FALSE, (LPARAM)(LPTOOLINFO) &m_ToolInfo);
        // don't set m_ttShown to FALSE, because we don't want the tooltip to show up again
        // without the mouse pointer first leaving the control and entering it again
    }

    CComboBoxEx::OnTimer(nIDEvent);
}
Example #11
0
void CImageWnd::UpdateClientArea(COLORREF color)
{
   if (m_pView != NULL && m_pViewWnd == NULL && m_pAppWnd != NULL)
   {
      CDC *pDc = m_pAppWnd->GetDC();
      CRect appRect;

      m_pAppWnd->GetClientRect(appRect);

      // Check if unused region of the AppWnd should be repainted
      int viewWidth = m_pView->GetWidth();
      int viewHeight = m_pView->GetHeight();

      if (appRect.Width() > viewWidth)
      {
         CRect rect = appRect;
         rect.left = viewWidth;

         pDc->FillSolidRect(rect, color);
      }

      if (appRect.Height() > viewHeight)
      {
         CRect rect = appRect;
         rect.top = viewHeight;

         pDc->FillSolidRect(rect, color);
      }

      m_pAppWnd->ReleaseDC(pDc);
   }
}
Example #12
0
CString CHistoryCombo::LoadHistory(LPCTSTR lpszSection, LPCTSTR lpszKeyPrefix)
{
    if (lpszSection == NULL || lpszKeyPrefix == NULL || *lpszSection == '\0')
        return L"";

    m_sSection = lpszSection;
    m_sKeyPrefix = lpszKeyPrefix;

    int n = 0;
    CString sText;
    do
    {
        //keys are of form <lpszKeyPrefix><entrynumber>
        CString sKey;
        sKey.Format(L"%s\\%s%d", (LPCTSTR)m_sSection, (LPCTSTR)m_sKeyPrefix, n++);
        sText = CRegString(sKey);
        if (!sText.IsEmpty())
            AddString(sText);
    } while (!sText.IsEmpty() && n < m_nMaxHistoryItems);

    SetCurSel(-1);

    ModifyStyleEx(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE, 0);

    // need to resize the control for correct display
    CRect rect;
    GetWindowRect(rect);
    GetParent()->ScreenToClient(rect);
    MoveWindow(rect.left, rect.top, rect.Width(), 100);

    return sText;
}
Example #13
0
//重画函数
void CWorldEdit::OnPaint()
{
	CPaintDC dc(this);

	//设置底图
	CGameImage * pBackImage=NULL;
	if (m_TitlePic.IsNull()==false) pBackImage=&m_TitlePic;
	else pBackImage=&CGameImageLink::m_TitleResource.m_BackPic;

	//绘画标题
	CRect ClientRect;
	GetClientRect(&ClientRect);
	CGameImageHelper ImageHandle(pBackImage);
	ImageHandle.StretchBlt(dc.GetSafeHdc(),ClientRect,CRect(0,0,ImageHandle.GetWidth(),ImageHandle.GetHeight()));
	dc.Draw3dRect(&ClientRect,RGB(0,0,200),RGB(0,0,250));

	//绘画图标
	if ((ClientRect.Width()>ICON_SIZE)&&(m_hIcon!=NULL))
	{
		DrawIconEx(dc.GetSafeHdc(),ClientRect.left+5,ClientRect.top+(ClientRect.Height()-ICON_SIZE)/2,m_hIcon,ICON_SIZE,ICON_SIZE,0,NULL,DI_NORMAL);
		ClientRect.left+=ICON_SIZE+5;
	}

	//绘画标题
	ClientRect.left+=5;
	CString strTitle;
	GetWindowText(strTitle);
	dc.SetBkMode(TRANSPARENT);
	dc.SelectObject(&CGameImageLink::m_HFont);
	dc.SetTextColor(CGameImageLink::m_TitleResource.m_crTextColor);
	DWORD dwStyte=GetStyle();
	if (dwStyte&SS_CENTER) dc.DrawText(strTitle,&ClientRect,DT_VCENTER|DT_CENTER|DT_SINGLELINE);
	else if (dwStyte&SS_RIGHT) dc.DrawText(strTitle,&ClientRect,DT_VCENTER|DT_RIGHT|DT_SINGLELINE);
	else dc.DrawText(strTitle,&ClientRect,DT_VCENTER|DT_LEFT|DT_SINGLELINE);
}
Example #14
0
//鼠标移动消息
void CControlMessage::OnMouseMove(UINT nFlags, CPoint point)
{
	if (m_SplitWnd.GetSafeHwnd()!=NULL)
	{
		CRect ClientRect;
		GetClientRect(&ClientRect);
		ClientRect.right=__max(ClientRect.right,3);
		MapWindowPoints(GetParent(),&ClientRect);
		MapWindowPoints(GetParent(),&point,1);
		CPoint PointCheck(point);
		if (m_bHorSplit==false)
		{
			PointCheck.x=__min(m_iMaxPos,__max(m_iLessPos,PointCheck.x));
			ClientRect.OffsetRect((PointCheck.x-ClientRect.Width()/2-ClientRect.left),0);
			if (PointCheck.x!=point.x) SetCursor(CGameImageLink::m_SplitResource.m_hDisableCur);
			else SetCursor(CGameImageLink::m_SplitResource.m_hHorCur);
		}
		else
		{
			PointCheck.y=__min(m_iMaxPos,__max(m_iLessPos,PointCheck.y));
			ClientRect.OffsetRect(0,(PointCheck.y-ClientRect.Height()/2-ClientRect.top));
			if (PointCheck.y!=point.y) SetCursor(CGameImageLink::m_SplitResource.m_hDisableCur);
			else SetCursor(CGameImageLink::m_SplitResource.m_hVorCur);
		}
		m_SplitWnd.MoveWindow(&ClientRect);
		m_SplitWnd.Invalidate(FALSE);
	}

	return;
}
void CChartCandlestickSerie::DrawLegend(CDC* pDC, const CRect& rectBitmap) const
{
	if (m_strSerieName == _T(""))
		return;
	if (!pDC->GetSafeHdc())
		return;

	NewPen.CreatePen(PS_SOLID,1,m_SerieColor);
	BrushFill.CreateSolidBrush(m_SerieColor);
	CBrush* pOldBrush = pDC->SelectObject(&BrushFill);
	CPen* pOldPen = pDC->SelectObject(&NewPen);
	int OldBkMode = pDC->SetBkMode(TRANSPARENT);

	int margin = (rectBitmap.Width() - m_iCandlestickWidth)/2;
	CRect CandleRect(rectBitmap.left+margin, rectBitmap.top+4,
					 rectBitmap.right-margin+1, rectBitmap.bottom-3);
	pDC->Rectangle(CandleRect);
	int MiddleX = rectBitmap.left + rectBitmap.Width()/2;
	pDC->MoveTo(MiddleX, CandleRect.top);
	pDC->LineTo(MiddleX, rectBitmap.top);
	pDC->MoveTo(MiddleX, CandleRect.bottom);
	pDC->LineTo(MiddleX, rectBitmap.bottom);

	pDC->SetBkMode(OldBkMode);
	pDC->SelectClipRgn(NULL);
	pDC->SelectObject(pOldPen);
	pDC->SelectObject(pOldBrush);
	BrushFill.DeleteObject();
	NewPen.DeleteObject();
}
Example #16
0
//时间消息
void CGameFrameControl::OnTimer(UINT nIDEvent)
{
    switch(nIDEvent)
    {
    case IDI_BROWER_AD:			//广告时间
    {
        m_bShowAd=!m_bShowAd;

        //调整控件
        CRect rcClient;
        GetClientRect(&rcClient);
        RectifyControl(rcClient.Width(),rcClient.Height());

        return;
    }
    case IDI_SWITCH_USER:		//切换信息
    {
        //删除时间
        KillTimer(IDI_SWITCH_USER);

        //更新信息
        m_UserInfoView.SetUserViewInfo(m_pIClientKernel->GetMeUserInfo());

        return;
    }
    }

    CDialog::OnTimer(nIDEvent);
}
int CWorkSpaceBar::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CBCGPDockingControlBar::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	CRect rectDummy;
	rectDummy.SetRectEmpty ();

	// Create tree windows.
	// TODO: create your own tab windows here:
	const DWORD dwViewStyle =	WS_CHILD | WS_VISIBLE | TVS_HASLINES | 
								TVS_LINESATROOT | TVS_HASBUTTONS;
	
	if (!m_wndTree.Create (dwViewStyle, rectDummy, this, 1))
	{
		TRACE0("Failed to create workspace view\n");
		return -1;      // fail to create
	}

	// Setup trees content:
	HTREEITEM hRoot1 = m_wndTree.InsertItem (_T("Root 1"));
	m_wndTree.InsertItem (_T("Item 1"), hRoot1);
	m_wndTree.InsertItem (_T("Item 2"), hRoot1);

	return 0;
}
Example #18
0
void CStaticLink::OnTimer(UINT nIDEvent) 
{
    CPoint p(GetMessagePos());
    ScreenToClient(&p);

	HBRUSH hbr = NULL;
    CRect rect;
    GetClientRect(rect);
    if (!rect.PtInRect(p))
    {
        m_bOverControl = FALSE;
	    KillTimer(m_nTimerID);
/*
	    CDC* pDC = GetDC();
		LOGFONT lf;
		GetFont()->GetObject(sizeof(lf), &lf);
		lf.lfUnderline = FALSE;
		m_font.DeleteObject();
		m_font.CreateFontIndirect(&lf);

		// use underline font and visited/unvisited colors
		pDC->SelectObject(&m_font);
*/		
		m_color = g_colorUnvisited;	// change color
		Invalidate();			// repaint 
        rect.bottom+=10;
        InvalidateRect(rect);
	}
	CStatic::OnTimer(nIDEvent);
}
Example #19
0
void CVODServerView::OnSize(UINT nType, int cx, int cy)
{
	CFormView::OnSize(nType, cx, cy);

	CRect rcClient;
	GetClientRect(&rcClient);
	/*CWnd* pWnd = GetDlgItem(IDC_DATAGRID);
	if (pWnd)
		pWnd->MoveWindow(0, 0, rcClient.Width(), rcClient.Height());
*/
	//如何知道窗口存在不存在呢?掉个函数  ( 把控制条关掉右边的视频信息列表也是最大化的)
	//m_wndGrid.GetSafeHwnd();//获取和该对象m_wndGrid相关的窗口句柄 
	if (m_wndGrid.GetSafeHwnd())//判断控件的窗口句柄
	{
		m_wndGrid.MoveWindow(0, 0, rcClient.Width(), rcClient.Height());
	//去掉滚动条的(缩小看下面)
		
		//m_wndGrid.put_ScrollBars(0);
		m_wndGrid.SetScrollBars(0);

	}


	//if (m_wndGrid.GetSafeHwnd())
	//{
	//	m_wndGrid.SetScrollBars(0);
	//}

	// TODO:  在此处添加消息处理程序代码
}
Example #20
0
void CFrameWnd::OnResize(int iFlag, const CSize& rNewSize)
{
	// Only when our window is changed.
	if ( (iFlag == SIZE_RESTORED) || (iFlag == SIZE_MAXIMIZED) )
	{
		// Resize toolbar.
		if (m_pToolBar)
		{
			// Get current pos.
			CRect rcToolBar = m_pToolBar->ClientRect();
			
			// Calc new pos and move.
			CRect rcNewPos(0, 0, rNewSize.cx, rcToolBar.Size().cy);
			m_pToolBar->Move(rcNewPos);
		}
		
		// Resize Status bar.
		if (m_pStatusBar)
		{
			// Get current pos.
			CRect rcStatusBar = m_pStatusBar->ClientRect();

			// Calc new pos and move.
			CRect rcNewPos(0, rNewSize.cy - rcStatusBar.Size().cy, 
								rNewSize.cx, rNewSize.cy);
			m_pStatusBar->Move(rcNewPos);
		}
	}
}
Example #21
0
void KGIniListCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
    CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);

    LPKGLISTITEM pItem = (LPKGLISTITEM)GetItemData(lpDrawItemStruct->itemID);
    USER_ITEM_DATA itemData;

    KGListCtrl::DrawItem(lpDrawItemStruct);

    KG_PROCESS_ERROR(pItem);

    pItem->GetStructData(&itemData, sizeof(itemData));

    if (itemData.dwValueType == VALUE_COLOR)
    {
        COLORREF colorRef = (COLORREF)atoi(itemData.szPropertyValue);
        CRect rect;
        GetSubItemRect(
            lpDrawItemStruct->itemID, 1, LVIR_BOUNDS, rect
        );
        rect.left += 12;
        rect.top  += 2;
        rect.bottom -= 1;
        rect.right = rect.left + rect.Height();
        pDC->FillRect(&rect, &CBrush(colorRef));
        pDC->Draw3dRect(&rect, RGB(100, 100, 100), RGB(100, 100, 100));
    }

Exit0:
    return;
}
Example #22
0
CRect CFrameWnd::ClientRect(void) const
{
	CRect rcClient;

	// Get the maximum size.
	::GetClientRect(m_hWnd, &rcClient);

	// Has a visible toolbar.
	if ( (m_pToolBar) && (m_pToolBar->IsVisible()) )
	{
		// Get current pos.
		CRect rcToolBar = m_pToolBar->ClientRect();
			
		// Adjust client rect.
		rcClient.top += rcToolBar.Height();
	}

	// Has a visible info line.
	if ( (m_pStatusBar) && (m_pStatusBar->IsVisible()) )
	{
		// Get current pos.
		CRect rcStatusBar = m_pStatusBar->ClientRect();

		// Adjust client rect.
		rcClient.bottom -= rcStatusBar.Height();
	}
	
	return rcClient;
}
//****************************************************************************
void CBCGPDropDownList::OnDrawItem (CDC* pDC, CBCGPToolbarMenuButton* pItem, 
									BOOL bHighlight)
{
	ASSERT_VALID (this);
	ASSERT_VALID (pDC);
	ASSERT_VALID (pItem);

	CRect rectText = pItem->Rect ();
	rectText.DeflateRect (2 * TEXT_MARGIN, 0);

#ifndef BCGP_EXCLUDE_RIBBON
	if (m_pRibbonCombo != NULL)
	{
		ASSERT_VALID (m_pRibbonCombo);

		int nIndex = (int) idStart - pItem->m_nID;

		if (m_pRibbonCombo->OnDrawDropListItem (pDC, nIndex,
			pItem, bHighlight))
		{
			return;
		}
	}
#else
	UNREFERENCED_PARAMETER(bHighlight);
#endif

	pDC->DrawText (pItem->m_strText, &rectText, DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX);
}
void CReportEntityLine::Draw( CDC* dc, CRect rect )
/* ============================================================
	Function :		CReportEntityLine::Draw
	Description :	Draws the object.
	Access :		Public

	Return :		void
	Parameters :	CDC* dc		-	"CDC" to draw to
					CRect rect	-	True (zoomed) rectangle to 
									draw to.
					
	Usage :			Called from "CDiagramEditor::DrawObjects".

   ============================================================*/
{
	CPen pen;
	const float* table = Drawer::GetColorByIndex(GetBorderColor());
	COLORREF clr = RGB((int)(table[0]*255.0f),(int)(table[1]*255.0f),(int)(table[2]*255.0f));
	pen.CreatePen( PS_SOLID, GetBorderThickness(), clr );
	dc->SelectObject( &pen );

	dc->MoveTo( rect.TopLeft() );
	dc->LineTo( rect.BottomRight() );

	dc->SelectStockObject( BLACK_PEN );

}
//绘画背景
BOOL CDlgEnquire::OnEraseBkgnd(CDC * pDC)
{
	//获取位置
	CRect rcClient;
	GetClientRect(&rcClient);

	//建立缓冲
	CImage ImageBuffer;
	ImageBuffer.Create(rcClient.Width(),rcClient.Height(),32);

	//创建 DC
	CImageDC BufferDC(ImageBuffer);
	CDC * pBufferDC=CDC::FromHandle(BufferDC);

	//设置缓冲
	pBufferDC->SetBkMode(TRANSPARENT);
	pBufferDC->SelectObject(CSkinResourceManager::GetInstance()->GetDefaultFont());

	//加载资源
	CPngImage ImageBack;
	ImageBack.LoadImage(AfxGetInstanceHandle(),TEXT("DLG_ENQUIRE_BACK"));

	//绘画背景
	ImageBack.DrawImage(pBufferDC,0,0);

	//绘画界面
	pDC->BitBlt(0,0,rcClient.Width(),rcClient.Height(),pBufferDC,0,0,SRCCOPY);

	return TRUE;
}
Example #26
0
void CPlayerToolBar::ArrangeControls()
{
    if (!::IsWindow(m_volctrl.m_hWnd)) {
        return;
    }

    CRect r;
    GetClientRect(&r);

    CRect br = GetBorders();

    CRect r10;
    GetItemRect(10, &r10);

    CRect vr(r.right + br.right - 60, r.top - 2, r.right + br.right + 6, r.bottom);
    m_volctrl.MoveWindow(vr);

    CRect thumbRect;
    m_volctrl.GetThumbRect(thumbRect);
    m_volctrl.MapWindowPoints(this, thumbRect);
    vr.top += std::max((r.bottom - thumbRect.bottom - 4) / 2, 0l);
    vr.left -= m_volumeMinSizeInc = MulDiv(thumbRect.Height(), 50, 19) - 50;
    m_volctrl.MoveWindow(vr);

    UINT nID;
    UINT nStyle;
    int iImage;
    GetButtonInfo(12, nID, nStyle, iImage);
    SetButtonInfo(11, GetItemID(11), TBBS_SEPARATOR, vr.left - iImage - r10.right - (r10.bottom - r10.top) + 11);
}
Example #27
0
void COscillDlg::OnPaint() 
{
    if (IsIconic())
    {
        CPaintDC dc(this); // device context for painting
        
        SendMessage( WM_ICONERASEBKGND, ( WPARAM ) dc.GetSafeHdc(), 0 );
        
        // Center icon in client rectangle
        int cxIcon = GetSystemMetrics( SM_CXICON );
        int cyIcon = GetSystemMetrics( SM_CYICON );
        CRect rect;
        GetClientRect( &rect );
        int x = ( rect.Width() - cxIcon + 1 ) / 2;
        int y = ( rect.Height() - cyIcon + 1 ) / 2;
        
        // Draw the icon
        dc.DrawIcon(x, y, m_hIcon);
    }
    else
    {   
		CDialog::OnPaint();
    }

	UpdateFrame( CLEAR );

}
Example #28
0
// Resizes all the gadgets in an array to match the new size.
// Generally called from an OnSize routine (or the like)
void ResizeGadgetsOnWindow(GADGETRESIZEHANDLE Handle, int cx, int cy)
	{
	CPtrArray* pArray = (CPtrArray*)Handle;		
	
	if (pArray == NULL || cx == 0 || cy == 0)
		return;
	
	ASSERT(pArray->GetSize() > 0);	// must be at least one element in the array
	
	// if auto-sizing, go thru and reposition all the controls.
	CSize sizeWndOrig = ((RECT_AND_HWND*)pArray->GetAt(0))->m_rect.Size();
	for (int i = 1; i < pArray->GetSize(); i++)
		{
		RECT_AND_HWND* pRectWnd = (RECT_AND_HWND*)pArray->GetAt(i);
		CRect newRect = pRectWnd->m_rect;
		CSize sizeCtlOrig = newRect.Size();
		newRect.top    = newRect.top    * cy / sizeWndOrig.cy;
		newRect.left   = newRect.left   * cx / sizeWndOrig.cx;
		newRect.right  = newRect.right  * cx / sizeWndOrig.cx;
		// if bottom is < 0, then kepp it fixed height - used for combo boxes
		// where we don't really want to resize most of them...
		if (newRect.bottom < 0)
			newRect.bottom = newRect.top - newRect.bottom;
		else 
			newRect.bottom = newRect.bottom * cy / sizeWndOrig.cy;

		::SetWindowPos(pRectWnd->m_hWnd, NULL,
			newRect.left, newRect.top, newRect.Width(), newRect.Height(),
			SWP_NOZORDER);
		}
	}
Example #29
0
BOOL CCalculationCtrlPage::OnInitDialog()
{
    CPropertyPage::OnInitDialog();

    m_currentItemIdx = -1;
    m_voltageRadio.SetCheck(TRUE);
    m_resultListView.SetDataSource(&m_viewItems);

    m_circuitryCombo.AddString(_T("Parallel"));
    m_circuitryCombo.AddString(_T("Series"));
    m_circuitryCombo.SetCurSel(0);

    m_bar.Create(this); //Status bar
    UINT BASED_CODE indicators[] = { ID_STATUS};
    m_bar.SetIndicators(indicators,1); //Anzahl panes
    CRect rect;
    GetClientRect(&rect);
    m_bar.SetPaneInfo(0,ID_STATUS, SBPS_NORMAL,rect.Width());
    RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, ID_STATUS);

    //m_searchValueEdit.SubclassDlgItem(IDC_CALCULATIONPAGE_LOADVALUE_EDIT, this);
    m_searchValueEdit.DragAcceptFiles(TRUE);

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
Example #30
0
//-------------------------------------------------------------------------------
//① 설       명  :	바닥에 이미지 넣자.
//② 인       수  :
//③ 리       턴  :
//-------------------------------------------------------------------------------
void BBVideoDlg::vDrawText(CDC* pDC)
{	
	//-------------------------------------------------
	// 메모리 DC를 생성한다.
	//-------------------------------------------------
	CDC MemDC;
	MemDC.CreateCompatibleDC( pDC);

	//-------------------------------------------------
	// 비트맵 객체를 생성한다. - TITLE BITMAP 로드한다
	//-------------------------------------------------
	MemDC.SetBkMode(TRANSPARENT);
	CBitmap  MemBitmap, MemBitmap1;
	MemBitmap.LoadBitmap(MAKEINTRESOURCE(IDB_BM_MANDO_VIDEO));
	CRect rc;
	GetClientRect( &rc );
	CBitmap *pOldBitmap = (CBitmap *)MemDC.SelectObject(&MemBitmap);
		
	if(m_nControlH > 125)
		pDC->StretchBlt(0, 0, rc.Width(), rc.Height() - m_nControlH-0, &MemDC, 0, 0, 777, 464-0, SRCCOPY); 
	else 
		pDC->StretchBlt(0, 0, rc.Width(), rc.Height() - m_nControlH-30, &MemDC, 0, 0, 777, 464-30, SRCCOPY); 

	
	//MemBitmap1.LoadBitmap(MAKEINTRESOURCE(IDB_BM_MANDO));
	//pOldBitmap = (CBitmap *)MemDC.SelectObject(&MemBitmap1);
	//pDC->BitBlt(rc.Width() - 280, 1, rc.Width(), 34, &MemDC, 0, 0, SRCCOPY); 

	MemDC.SelectObject( pOldBitmap );
	MemBitmap.DeleteObject();
	//MemBitmap1.DeleteObject();
	MemDC.DeleteDC();
}