コード例 #1
0
void CFavoriteOrganizeDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
	if(nIDCtl != IDC_LIST2) return;

	int nItem = lpDrawItemStruct->itemID;
	CRect rcItem = lpDrawItemStruct->rcItem;

	CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);

	if(!!m_list.GetItemState(nItem, LVIS_SELECTED))
	{
		FillRect(pDC->m_hDC, rcItem, CBrush(0xf1dacc));
		FrameRect(pDC->m_hDC, rcItem, CBrush(0xc56a31));
	}
	else
	{
		CBrush b;
		b.CreateSysColorBrush(COLOR_WINDOW);
		FillRect(pDC->m_hDC, rcItem, b);
	}

	CString str = m_list.GetItemText(nItem, 0);

	pDC->SetTextColor(0);
	pDC->TextOut(rcItem.left+3, (rcItem.top+rcItem.bottom - pDC->GetTextExtent(str).cy)/2, str);
}
コード例 #2
0
ファイル: CClock.cpp プロジェクト: njustccy/NjustTool
void CClock::DrawTime( CDC *pDc )
{
	CRect  rtClient;
	GetClientRect(&rtClient);
	CDC  dcTransparent;
	dcTransparent.CreateCompatibleDC(pDc);
	CBitmap bitTransParent;
	bitTransParent.CreateCompatibleBitmap(pDc, rtClient.Width(),rtClient.Height());
	dcTransparent.SelectObject(&bitTransParent);

	// 		CRect rectReal(ix1, iy1, ix2, iy2);
	dcTransparent.FillSolidRect(rtClient, RGB(255, 255, 255));
	// 		dcTransparent.Draw3dRect(rectReal, RGB(111, 147, 188), RGB(111, 147, 188));

	dcTransparent.BeginPath();
	dcTransparent.MoveTo(rtClient.Width()/2, rtClient.Height()/2);
	dcTransparent.LineTo(rtClient.Width()/2-80, rtClient.Height()/2);

	float   fEnd = 90.0f;
	dcTransparent.AngleArc(rtClient.Width()/2, rtClient.Height()/2, 120, -180.0f, 270.0f);
	dcTransparent.LineTo(rtClient.Width()/2, rtClient.Height()/2);

	dcTransparent.EndPath();
	CRgn rgn;
	rgn.CreateFromPath(&dcTransparent);
	dcTransparent.FillRgn(&rgn, &CBrush(RGB(188, 199, 216)));

	//内
	dcTransparent.BeginPath();
	dcTransparent.MoveTo(rtClient.Width()/2, rtClient.Height()/2);
	dcTransparent.LineTo(rtClient.Width()/2-40, rtClient.Height()/2);

	dcTransparent.AngleArc(rtClient.Width()/2, rtClient.Height()/2, 40, -180.0f, 270.0f);
	dcTransparent.LineTo(rtClient.Width()/2, rtClient.Height()/2);

	dcTransparent.EndPath();
	CRgn rgn1;
	rgn1.CreateFromPath(&dcTransparent);
	dcTransparent.FillRgn(&rgn1, &CBrush(RGB(255, 255, 0)));

	if( ::AlphaBlend == 0 )
	{
		pDc->StretchBlt(0, 0, rtClient.Width(), rtClient.Height(), 
			&dcTransparent, 0, 0, rtClient.Width(), rtClient.Height(), SRCINVERT );

	}else{

		BLENDFUNCTION bf;    
		memset( &bf, 0, sizeof( bf ) );
		bf.SourceConstantAlpha = 0x9f; //半透明
		bf.BlendOp = AC_SRC_OVER;

		::TransparentBlt(pDc->GetSafeHdc(), 0, 0, rtClient.Width(), rtClient.Height(), 
			dcTransparent.GetSafeHdc( ), 0, 0, rtClient.Width(), rtClient.Height(), RGB(255, 255, 255));
		// 			::AlphaBlend( memDC.GetSafeHdc(), 0, 0, rtClient.Width(), rtClient.Height(), 
		// 				dcTransparent.GetSafeHdc( ), 0, 0, rtClient.Width(), rtClient.Height(), bf );  
	}
	bitTransParent.DeleteObject();
	dcTransparent.DeleteDC();
}
コード例 #3
0
void CPlayerPlaylistBar::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
    if (nIDCtl != IDC_PLAYLIST) {
        return;
    }

    int nItem = lpDrawItemStruct->itemID;
    CRect rcItem = lpDrawItemStruct->rcItem;
    POSITION pos = FindPos(nItem);
    bool fSelected = pos == m_pl.GetPos();
    CPlaylistItem& pli = m_pl.GetAt(pos);

    CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);

    if (!!m_list.GetItemState(nItem, LVIS_SELECTED)) {
        FillRect(pDC->m_hDC, rcItem, CBrush(0xf1dacc));
        FrameRect(pDC->m_hDC, rcItem, CBrush(0xc56a31));
    } else {
        FillRect(pDC->m_hDC, rcItem, CBrush(GetSysColor(COLOR_WINDOW)));
    }

    COLORREF textcolor = fSelected ? 0xff : 0;
    if (pli.m_fInvalid) {
        textcolor |= 0xA0A0A0;
    }

    CString time = !pli.m_fInvalid ? m_list.GetItemText(nItem, COL_TIME) : _T("Invalid");
    CSize timesize(0, 0);
    CPoint timept(rcItem.right, 0);
    if (time.GetLength() > 0) {
        timesize = pDC->GetTextExtent(time);
        if ((3 + timesize.cx + 3) < rcItem.Width() / 2) {
            timept = CPoint(rcItem.right - (3 + timesize.cx + 3), (rcItem.top + rcItem.bottom - timesize.cy) / 2);

            pDC->SetTextColor(textcolor);
            pDC->TextOut(timept.x, timept.y, time);
        }
    }

    CString fmt, file;
    fmt.Format(_T("%%0%dd. %%s"), (int)log10(0.1 + m_pl.GetCount()) + 1);
    file.Format(fmt, nItem + 1, m_list.GetItemText(nItem, COL_NAME));
    CSize filesize = pDC->GetTextExtent(file);
    while (3 + filesize.cx + 6 > timept.x && file.GetLength() > 3) {
        file = file.Left(file.GetLength() - 4) + _T("...");
        filesize = pDC->GetTextExtent(file);
    }

    if (file.GetLength() > 3) {
        pDC->SetTextColor(textcolor);
        pDC->TextOut(rcItem.left + 3, (rcItem.top + rcItem.bottom - filesize.cy) / 2, file);
    }
}
コード例 #4
0
void CEditListEditor::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
    if (nIDCtl != IDC_EDITLIST) {
        return;
    }

    int nItem = lpDrawItemStruct->itemID;
    CRect rcItem = lpDrawItemStruct->rcItem;
    POSITION pos = m_editList.FindIndex(nItem);

    if (pos) {
        bool fSelected = (pos == m_curPos);
        UNREFERENCED_PARAMETER(fSelected);
        CClip& curClip = m_editList.GetAt(pos);
        CString strTemp;

        CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);

        if (!!m_list.GetItemState(nItem, LVIS_SELECTED)) {
            FillRect(pDC->m_hDC, rcItem, CBrush(0xf1dacc));
            FrameRect(pDC->m_hDC, rcItem, CBrush(0xc56a31));
        } else {
            FillRect(pDC->m_hDC, rcItem, CBrush(GetSysColor(COLOR_WINDOW)));
        }

        COLORREF textcolor = RGB(0, 0, 0);
        if (!curClip.HaveIn() || !curClip.HaveOut()) {
            textcolor = RGB(255, 0, 0);
        }

        for (int i = 0; i < COL_MAX; i++) {
            m_list.GetSubItemRect(nItem, i, LVIR_LABEL, rcItem);
            pDC->SetTextColor(textcolor);
            switch (i) {
                case COL_INDEX:
                    strTemp.Format(_T("%d"), nItem + 1);
                    pDC->DrawText(strTemp, rcItem, DT_CENTER | DT_VCENTER);
                    break;
                case COL_IN:
                    pDC->DrawText(curClip.GetIn(), rcItem, DT_CENTER | DT_VCENTER);
                    break;
                case COL_OUT:
                    pDC->DrawText(curClip.GetOut(), rcItem, DT_CENTER | DT_VCENTER);
                    break;
                case COL_NAME:
                    pDC->DrawText(curClip.GetName(), rcItem, DT_LEFT | DT_VCENTER);
                    break;
            }
        }
    }
}
コード例 #5
0
ファイル: KGListCtrl.cpp プロジェクト: viticm/pap2
int KGListCtrl::DrawRect(
						 CDC* dc, CRect rt, COLORREF colorFrame, COLORREF colorBack, int nFlag
						 )
{
	int nLen = (int)((rt.right - rt.left) * 0.5); 

	CPoint point_top(rt.left + nLen, rt.top + 2); 
	CPoint point_dwn(rt.left + nLen, rt.bottom - 1);
	CPoint point_lef(rt.left + 2, rt.top + nLen);
	CPoint point_rig(rt.right - 1, rt.top + nLen);

	dc->FillRect(&rt, &CBrush(colorBack));
	CPen pen(PS_SOLID, 1, colorFrame);
	dc->SelectObject(&pen);
	dc->MoveTo(rt.left,  rt.top);
	dc->LineTo(rt.right, rt.top);
	dc->LineTo(rt.right, rt.bottom);
	dc->LineTo(rt.left,  rt.bottom);
	dc->LineTo(rt.left,  rt.top);

	if (nFlag)
	{
		dc->MoveTo(point_top);
		dc->LineTo(point_dwn);
		dc->MoveTo(point_lef);
		dc->LineTo(point_rig);
	}
	else
	{
		dc->MoveTo(point_lef);
		dc->LineTo(point_rig);
	}

	return true;
}
コード例 #6
0
ファイル: BarShader.cpp プロジェクト: LjApps/eMule-VeryCD
void CBarShader::FillRect(CDC *dc, LPRECT rectSpan, float fRed, float fGreen,
						  float fBlue, bool bFlat) {
	if(bFlat) {
		COLORREF color = RGB((int)(fRed + .5f), (int)(fGreen + .5f), (int)(fBlue + .5f));
		dc->FillRect(rectSpan, &CBrush(color));
	} else {
		if (m_Modifiers == NULL || (m_used3dlevel!=thePrefs.Get3DDepth() && !m_bIsPreview) )
			BuildModifiers();
		RECT rect = *rectSpan;
		int iTop = rect.top;
		int iBot = rect.bottom;
		int iMax = HALF(m_iHeight);
		for(int i = 0; i < iMax; i++) {
			CBrush cbNew(RGB((int)(fRed * m_Modifiers[i] + .5f), (int)(fGreen * m_Modifiers[i] + .5f), (int)(fBlue * m_Modifiers[i] + .5f)));
			
			rect.top = iTop + i;
			rect.bottom = iTop + i + 1;
			dc->FillRect(&rect, &cbNew);

			rect.top = iBot - i - 1;
			rect.bottom = iBot - i;
			dc->FillRect(&rect, &cbNew);
		}
	}
}
コード例 #7
0
void CCJControlBar::OnNcPaint() 
{
    // get window DC that is clipped to the non-client area
    CWindowDC dc(this);

	CRect rectWindow;
	GetWindowRect(rectWindow);
	ScreenToClient(rectWindow);

	CRect rectClient;
	GetClientRect(rectClient);
	rectClient.OffsetRect(-rectWindow.left, -rectWindow.top);
	dc.ExcludeClipRect(rectClient);
	
    // draw borders in non-client area
	rectWindow.OffsetRect(-rectWindow.left, -rectWindow.top);
	DrawBorders(&dc, rectWindow);
	
    // erase parts not drawn
	dc.IntersectClipRect(rectWindow);
	
    // erase NC background the hard way
	dc.FillRect(rectWindow, &CBrush(::GetSysColor(COLOR_BTNFACE)));
	
    // paint the mobile edge
    dc.Draw3dRect(m_rectBorder, ::GetSysColor(COLOR_BTNHIGHLIGHT),
        ::GetSysColor(COLOR_BTNSHADOW));
	
    ReleaseDC(&dc);
}
コード例 #8
0
void CEditListCtrl::OnPaint() 
{	
	//CPaintDC dc(this); // device context for painting	
	
	if (m_iSubItem >= 0 && m_edtItemEdit.m_hWnd)	
	{
		CRect	rect;
		CRect	rcEdit;
		m_edtItemEdit.GetWindowRect(rcEdit);
		ScreenToClient(rcEdit);

		GetSubItemRect(m_iItem, m_iSubItem, LVIR_LABEL, rect);

		//当文本编辑框缩小时,擦除露出的项文本高亮部分
		if (rcEdit.right < rect.right)
		{
			rect.left = rcEdit.right;
			CClientDC dc(this);
			dc.FillRect(rect, &CBrush(::GetSysColor(COLOR_WINDOW)));
			ValidateRect(rect);
		}

	}

	CListCtrl::OnPaint();
}
コード例 #9
0
void KGClassButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
	CClientDC dc(this);
	COLORREF color;
	CRect rect;
	CPen  pen;

	GetClientRect(&rect);
	dc.FillRect(&rect, &CBrush(RGB(255, 255, 255)));
	if (m_nStateFlag)
	{
		color = RGB(255, 2, 2);
	}
	else
	{
		color = RGB(100, 100, 100);
	}

	pen.CreatePen(PS_SOLID, 2, color);
	dc.SelectObject(&pen);

	if (m_hButtonIcon)
	{
		dc.DrawIcon(rect.left, rect.top, m_hButtonIcon);
	}

	if (m_nSelFlag)
	{
		dc.MoveTo(rect.left, rect.top);
		dc.LineTo(rect.right, rect.top);
		dc.LineTo(rect.right, rect.bottom);
		dc.LineTo(rect.left, rect.bottom);
		dc.LineTo(rect.left, rect.top - 2);
	}
}
コード例 #10
0
ファイル: KGInIFileEditDlg.cpp プロジェクト: viticm/pap2
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;
}
コード例 #11
0
ファイル: MyListCtrl.cpp プロジェクト: 2Dou/PlayBox
void CMyListCtrl::SetItemBkColor(CDC* pDC,BOOL bHighlight,int iItem,const CRect& rect)
{
	// Draw the background color
	if( bHighlight )
	{
		pDC->SetBkColor( m_clrSelItemBK);
		pDC->FillRect(rect, &CBrush( m_clrSelItemBK));
	}
	else
	{
		vector<int>::iterator ite=find(m_vecSearchedItems.begin(),m_vecSearchedItems.end(),iItem);
		if (ite!=m_vecSearchedItems.end())
		{
			pDC->SetBkColor( m_colorSearchHightLight);
			pDC->FillRect(rect, &CBrush( m_colorSearchHightLight));
		}
		else
		{
			if( iItem % 2 )
			{
				pDC->SetBkColor( m_clrOddItemBK);
				pDC->FillRect(rect, &CBrush( m_clrOddItemBK));
			}
			else
			{
				pDC->SetBkColor( m_clrEvenItemBK );
				pDC->FillRect(rect, &CBrush( m_clrEvenItemBK ));
			}
		}
	}
/*
	if( m_bDrawItemTopLine )
	{
		//Item上画一条分割线
		CRect rcTopLine = rect;
		rcTopLine.bottom = rcTopLine.top + 1;
		pDC->FillRect(rcTopLine, &CBrush(RGB(241,246,249)));
	}
*/
	if( !bHighlight && m_bDrawHoverRow && m_iCurrentCursorItem == iItem )
	{
		CDibBitmap *pDib = ::AfxGetUIManager()->UIGetSkinMgr()->GetDibBmp("ListHoverBK");
		pDib->SetCDibRect(rect);
		pDib->Draw(pDC, true);
	}
}
コード例 #12
0
ファイル: CBaseDlg.cpp プロジェクト: HGRun/MFC_UI_REPO
BOOL CBaseDlg::OnEraseBkgnd(CDC* pDC)
{
	CRect clientRect;
	GetClientRect(&clientRect);

	pDC->FillRect(&clientRect, &CBrush(m_bkColor));
	return FALSE;
}
コード例 #13
0
ファイル: QnStatic.cpp プロジェクト: Omgan/code4me
BOOL CQnStatic::OnEraseBkgnd(CDC* pDC)
{
	// TODO: 在此添加消息处理程序代码和/或调用默认值
	CRect rect;
	GetClientRect(rect);
	pDC->FillRect(rect, &CBrush(RGB(233,233,233)));
	return CStatic::OnEraseBkgnd(pDC);
}
コード例 #14
0
ファイル: ColorSlide.cpp プロジェクト: 2Dou/PlayBox
void CColorSlide::PaintBK(CRect aRect,HDC hMemDC)
{
	::SetBkMode(hMemDC,TRANSPARENT);



	COLORREF lcolorBack = ::GetBkColor(hMemDC);
	gBitMapOperate.FillRectangle(hMemDC, aRect, lcolorBack, true ) ;

	RECT lrcTrack     = aRect;
	lrcTrack.top     += 2;
	lrcTrack.bottom   = lrcTrack.top+7;
	lrcTrack.left    += TRACKBAR_INTERVAL;
	lrcTrack.right   -= TRACKBAR_INTERVAL;

	if( (m_iStatePosX)>=0 )
	{
		CDC::FromHandle(hMemDC)->FrameRect( &lrcTrack,&CBrush( gWndColor.getColor(SLIDER_CTROL)->structColBase->colFrame1) );
		::InflateRect(&lrcTrack,-1,-1);
		switch(m_SlideType)
		{
		case LIGHT_SLIDE:
			gBitMapOperate.FillRectangleLight( hMemDC,lrcTrack,m_colBegain,m_colEnd,m_nHue, gBitMapOperate.edoHorizontal, true, (lrcTrack.right - lrcTrack.left) );
			break;
		case HUE_SLIDE:
			gBitMapOperate.FillRectangleHue( hMemDC,lrcTrack,m_colBegain,m_colEnd, gBitMapOperate.edoHorizontal, true, (lrcTrack.right - lrcTrack.left) );
			break;
		case PERCENT_SLIDE:
			{
				CRect lrect1 = lrcTrack;
				lrect1.right = lrect1.left>m_iStatePosX? lrect1.left:m_iStatePosX;
				CDC::FromHandle(hMemDC)->FillRect( lrect1, &CBrush(m_colBegain ) );
				
				CRect lrect2 = lrcTrack;
				lrect2.left = lrect2.left>m_iStatePosX? lrect2.left:m_iStatePosX ;
				CDC::FromHandle(hMemDC)->FillRect( lrect2, &CBrush( m_colEnd ) );
			}
			break;
		case S_SLIDE:
			gBitMapOperate.FillRectangleS( hMemDC,lrcTrack,m_colBegain,m_colEnd,m_nHue, gBitMapOperate.edoHorizontal, true, (lrcTrack.right - lrcTrack.left) );
        break;
		default:
			break;
		}
	}
}
コード例 #15
0
ファイル: DrawButton.cpp プロジェクト: dulton/nampu
void CDrawButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) 
{
	
	//判断控件类型是否为按钮类型
	if (lpDrawItemStruct->CtlType == ODT_BUTTON)
	{
		CDC dc;

		
		dc.Attach(lpDrawItemStruct->hDC);	//附加设备上下文句柄
		//获取按钮状态
		int nState = lpDrawItemStruct->itemState;
		//获取按钮区域
		CRect btnRC = lpDrawItemStruct->rcItem;
		CString szBtnText;
		GetWindowText(szBtnText);	//获取按钮文本

		CPoint pt;
		GetCursorPos(&pt);
		ScreenToClient(&pt);
		
		COLORREF clrText;	//文本颜色
		clrText = RGB(0, 0, 0);
		COLORREF clrBK = RGB(220, 220, 220);		//背景颜色

		if (nState & ODS_SELECTED || nState & ODS_FOCUS)
		{
			clrBK = RGB(222, 231, 239);
		}
		if (m_nBtnState == 1)
		{
			clrText = RGB(255, 0, 255);
		}
		
		dc.SetTextColor(clrText);

		dc.FillRect(btnRC, &CBrush(clrBK));
		dc.FrameRect(btnRC, &CBrush(RGB(140, 158, 176)));


		dc.SetBkMode(TRANSPARENT);
		dc.DrawText(szBtnText, btnRC, DT_SINGLELINE|DT_CENTER|DT_VCENTER|DT_WORD_ELLIPSIS);
		dc.Detach();	//分离句柄
	}	
}
コード例 #16
0
ファイル: ExamInfoMgrDlg.cpp プロジェクト: jf4210/src2-test
BOOL CExamInfoMgrDlg::OnEraseBkgnd(CDC* pDC)
{
	CRect rcClient;
	GetClientRect(&rcClient);

	pDC->FillRect(rcClient, &CBrush(RGB(225, 222, 250)));

	return CDialog::OnEraseBkgnd(pDC);
}
コード例 #17
0
ファイル: TabCtrlEx.cpp プロジェクト: hackshields/antivirus
BOOL CTabCtrlEx::OnEraseBkgnd(CDC* pDC) 
{
	CRect rcClient, rcWnd;
	GetClientRect( &rcClient );

	pDC->FillRect(rcClient, &CBrush(m_nBg));

	return TRUE;
}
コード例 #18
0
HBRUSH ReportBalanceSeated::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	C_Hom_Doc *   lDocPtr = (C_Hom_Doc*)GetDocument();
 
   pDC->SetBkMode(TRANSPARENT);
   pDC->SetTextColor(GetSysColor(COLOR_WINDOWTEXT));

   return (HBRUSH)(CBrush(lDocPtr->getBalColor()));
}
コード例 #19
0
ファイル: CJOutlookBar.cpp プロジェクト: AzyxWare/ryzom
BOOL CCJOutlookBar::OnEraseBkgnd(CDC* pDC) 
{
	// Get the rect of the client area, and fill
	// the background color.
	CRect rcClient;
	GetClientRect( &rcClient );
	pDC->FillRect( rcClient, &CBrush( ::GetSysColor( COLOR_3DSHADOW ) ));
	return TRUE;
}
コード例 #20
0
void CListControlEx::DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct )
{
	// TODO:  添加您的代码以绘制指定项
	CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);

	LVITEM lvi = {0};
	lvi.mask = LVIF_STATE;
	lvi.stateMask = LVIS_FOCUSED | LVIS_SELECTED ;
	lvi.iItem = lpDrawItemStruct->itemID;
	BOOL bGet = GetItem(&lvi);

	BOOL bHighlight =((lvi.state & LVIS_DROPHILITED)||((lvi.state & LVIS_SELECTED) && ((GetFocus() == this)|| (GetStyle() & LVS_SHOWSELALWAYS))));

	CRect rcBack = lpDrawItemStruct->rcItem;

	if( bHighlight ) //高亮显示
	{
		pDC->SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT));
		pDC->SetBkColor(::GetSysColor(COLOR_HIGHLIGHT));
		pDC->FillRect(rcBack, &CBrush(::GetSysColor(COLOR_HIGHLIGHT)));
	}
	else
	{

		pDC->SetTextColor(::GetSysColor(COLOR_WINDOWTEXT));
		pDC->FillRect(rcBack, &CBrush(::GetSysColor(COLOR_WINDOW)));


	}
	//绘制文本
	CString strText=L"";
	CRect rcItem;
	if (lpDrawItemStruct->itemAction & ODA_DRAWENTIRE)
	{
		for (int i = 0; i < GetHeaderCtrl()-> GetItemCount();i++)
		{            
			if ( !GetSubItemRect(lpDrawItemStruct->itemID, i, LVIR_LABEL, rcItem ))
				continue;
			strText = GetItemText( lpDrawItemStruct->itemID, i );

			pDC->DrawText(strText,strText.GetLength(), &rcItem, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_BOTTOM);
		}
	}
}
コード例 #21
0
ファイル: LostCornerDlg.cpp プロジェクト: jf4210/src2-test
BOOL CLostCornerDlg::OnEraseBkgnd(CDC* pDC)
{
	CRect rcClient;
	GetClientRect(&rcClient);

	pDC->FillRect(rcClient, &CBrush(RGB(255, 255, 255)));	//225, 222, 250
	ReleaseDC(pDC);

	return CDialog::OnEraseBkgnd(pDC);
}
コード例 #22
0
ファイル: SingleExamDlg.cpp プロジェクト: jf4210/src2-test
BOOL CSingleExamDlg::OnEraseBkgnd(CDC* pDC)
{
	CDialog::OnEraseBkgnd(pDC);

	CRect rcClient;
	GetClientRect(&rcClient);

	pDC->FillRect(rcClient, &CBrush(RGB(255, 255, 255)));	//225, 242, 250

	//画虚线
	if (GetDlgItem(IDC_STATIC_ExamTime)->GetSafeHwnd())
	{
		CPen *pOldPen = NULL;
		CPen pPen;
		pPen.CreatePen(PS_DASH, 1, RGB(106, 218, 239));
		pOldPen = pDC->SelectObject(&pPen);

		CRect rtTmp;
		GetDlgItem(IDC_STATIC_ExamTime)->GetWindowRect(rtTmp);
		ScreenToClient(&rtTmp);

		CPoint pt1, pt2;
		pt1.x = rtTmp.left;
		pt1.y = rtTmp.bottom + 1;
		pt2.x = pt1.x + 350;
		pt2.y = pt1.y;
		pDC->MoveTo(pt1);
		pDC->LineTo(pt2);
		pDC->SelectObject(pOldPen);
		pPen.Detach();
	}
	DrawBorder(pDC);

	int iX, iY;
	CDC memDC;
	BITMAP bmp;
	if (memDC.CreateCompatibleDC(pDC))
	{
		CBitmap *pOldBmp = memDC.SelectObject(&m_bmpExamType);
		m_bmpExamType.GetBitmap(&bmp);
		pDC->SetStretchBltMode(COLORONCOLOR);
		pDC->StretchBlt(rcClient.right - bmp.bmWidth - 10, 1, bmp.bmWidth, bmp.bmHeight, &memDC, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);


		pOldBmp = memDC.SelectObject(&m_bmpExamTypeLeft);
		m_bmpExamTypeLeft.GetBitmap(&bmp);
		pDC->SetStretchBltMode(COLORONCOLOR);
		pDC->StretchBlt(rcClient.left, rcClient.top, bmp.bmWidth, rcClient.bottom, &memDC, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);

		memDC.SelectObject(pOldBmp);
	}
	memDC.DeleteDC();

	return TRUE;
}
コード例 #23
0
void CCoolHeaderBarCtrl::PaintHeader(CDC* pDC, CRect& rcBar, BOOL bTransparent)
{
	CString strCaption;
	GetWindowText( strCaption );
	
	CFont* pOldFont = (CFont*)pDC->SelectObject( &CoolInterface.m_fntBold );
	CSize szText = pDC->GetTextExtent( strCaption );
	
	pDC->SetTextColor( CoolInterface.m_crCmdText );
	pDC->SetBkColor( CoolInterface.m_crMidtone );

	int nMiddle = ( rcBar.top + rcBar.bottom ) / 2;

	if ( bTransparent )
	{
		DrawIconEx( pDC->GetSafeHdc(), rcBar.left + 4, nMiddle - 8,
			GetIcon( FALSE ), 16, 16, 0, CBrush(CoolInterface.m_crMidtone), DI_NORMAL );
		
		pDC->SetBkMode( TRANSPARENT );
		pDC->ExtTextOut( rcBar.left + 22, nMiddle - szText.cy / 2,
			ETO_CLIPPED, &rcBar, strCaption, NULL );
	}
	else
	{
		pDC->SetBkMode( OPAQUE );
		
		DrawIconEx( pDC->GetSafeHdc(), rcBar.left + 4, nMiddle - 8,
			GetIcon( FALSE ), 16, 16, 0, CBrush(CoolInterface.m_crMidtone), DI_NORMAL );
		
		pDC->ExcludeClipRect( rcBar.left + 4, nMiddle - 8, rcBar.left + 20, nMiddle + 8 );
		
		pDC->FillSolidRect( rcBar.left, rcBar.top, 20, rcBar.Height(),
			CoolInterface.m_crMidtone );

		rcBar.left += 20;
		pDC->ExtTextOut( rcBar.left + 2, nMiddle - szText.cy / 2,
			ETO_CLIPPED|ETO_OPAQUE, &rcBar, strCaption, NULL );
		rcBar.left -= 20;
	}

	pDC->SelectObject( pOldFont );
}
コード例 #24
0
BOOL CStatusBarDlg::OnEraseBkgnd(CDC* pDC)
{
	// TODO: 在此添加消息处理程序代码和/或调用默认值
	CRect rcClient;
	GetClientRect(&rcClient);

	pDC->FillRect(rcClient,&CBrush(RGB(230, 210 ,254)));	//RGB(237, 245 ,254)

	return TRUE;
	return CDialog::OnEraseBkgnd(pDC);
}
コード例 #25
0
ファイル: PopNoticeDlg.cpp プロジェクト: radtek/project4more
BOOL CPopNoticeDlg::OnEraseBkgnd(CDC* pDC)
{
	// TODO: 在此添加消息处理程序代码和/或调用默认值
	CRect rect;
	GetClientRect(&rect);
	//pDC->FillRect(&rect, &CBrush(RGB(199, 237, 204)));
	pDC->FillRect(&rect, &CBrush(RGB(255, 255, 255)));
	return 0;

	//return CDialog::OnEraseBkgnd(pDC);
}
コード例 #26
0
ファイル: NewModelDlg.cpp プロジェクト: jf4210/src2-test
BOOL CNewModelDlg::OnEraseBkgnd(CDC* pDC)
{
	CDialog::OnEraseBkgnd(pDC);

	CRect rcClient;
	GetClientRect(&rcClient);

	pDC->FillRect(rcClient, &CBrush(RGB(255, 255, 255)));	//225, 242, 250

	return TRUE;
}
コード例 #27
0
HBRUSH ReportTaskInputSummary::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CFormView::OnCtlColor(pDC, pWnd, nCtlColor);
	
	C_Hom_Doc *   lDocPtr = (C_Hom_Doc*)GetDocument();
	
	pDC->SetBkMode(TRANSPARENT);
	pDC->SetTextColor(GetSysColor(COLOR_WINDOWTEXT));
	pDC->SetBkColor(lDocPtr->getBalColor());
	
	return (HBRUSH)(CBrush(lDocPtr->getBalColor()));
}
コード例 #28
0
ファイル: ScanMgrDlg.cpp プロジェクト: jf4210/src2-test
BOOL CScanMgrDlg::OnEraseBkgnd(CDC* pDC)
{
	CRect rcClient;
	GetClientRect(&rcClient);

	pDC->FillRect(rcClient, &CBrush(RGB(255, 255, 255)));	//225, 222, 250
	DrawBorder(pDC);

	ReleaseDC(pDC);

	return CDialog::OnEraseBkgnd(pDC);
}
コード例 #29
0
ファイル: PrevDlg.cpp プロジェクト: ptthisdan/DIPVC
/******************************************************************************
*	作用:		预览框重绘函数
******************************************************************************/
void CPrevDlg::Redraw(void)
{
	CDC* pDC = m_staPrev.GetDC();
	Graphics graph(pDC->GetSafeHdc());
	CRect rect;

	m_staPrev.GetClientRect(rect);
	pDC->FillRect(rect, &CBrush(RGB(211, 211, 211)));

	if (m_nPos >= 0)
	{
		CString m_strFilePath = m_strPath + L"\\" + m_FilesNameAry[m_nPos];
		Image image(m_strFilePath);
		CRect rect;

		m_staPrev.GetClientRect(rect);

		REAL width  = (REAL)image.GetWidth();
		REAL height = (REAL)image.GetHeight();
		REAL c		= 0.0f;
		REAL x		= 0.0f;
		REAL y		= 0.0f;

		// 按适合宽度模式处理
		width = (REAL)rect.Width();
		c = width / image.GetWidth();

		// 如果没有超界
		if (c * image.GetHeight() < rect.Height())
			height = c * image.GetHeight();
		// 超界则采用适合高度模式
		else
		{
			height = (REAL)rect.Height();
			c = height / image.GetHeight();
			width = c * image.GetWidth();
		}

		// 使图像居中
		if ((UINT)rect.Width() > width)
			x = (rect.Width() - width) / 2.0f;

		if ( (UINT)rect.Height() > height )
			y = ((UINT)rect.Height() - height) / 2.0f;

		graph.DrawImage(&image, x, y, width, height);
	}

	ReleaseDC(pDC);
}
コード例 #30
0
void CListBoxExWZ::DrawItem(LPDRAWITEMSTRUCT lpDS)
{
	CDC dc;
	dc.Attach(lpDS->hDC);

	CRect rcText(lpDS->rcItem);

	if (((lpDS->itemAction | ODA_SELECT) && (lpDS->itemState & ODS_SELECTED)) ||
		((lpDS->itemAction | ODA_FOCUS) && (lpDS->itemState & ODS_FOCUS)) )
	{
		dc.FillRect(&rcText, &CBrush(&m_bmListBoxExSel));
	}
	else
	{
		dc.FillRect(&rcText, &CBrush(&m_bmListBoxExDef));
	}

	rcText.DeflateRect(2, 2, 2, 2);
	rcText.left += 32;
	dc.DrawText(m_lstItemData[lpDS->itemID].szText, -1, &rcText, DT_LEFT|DT_SINGLELINE|DT_VCENTER);

	dc.Detach();
}