Ejemplo n.º 1
0
//绘画边框
void CSkinDialogEx::DrawBorder(CDC * pDC)
{
	//获取位置
	CRect ClientRect;
	GetClientRect(&ClientRect);
	int nXExcursion=GetXExcursionPos();
	int nYExcursion=GetYExcursionPos();

	//创建笔画
	CPen BorderPen(PS_SOLID,1,m_SkinAttribute.m_crInsideBorder);
	CPen * pOldPen=pDC->SelectObject(&BorderPen);

	//绘画内框
	CRect rcDrawRect(nXExcursion,nYExcursion,ClientRect.Width()-2*nXExcursion,ClientRect.Height());
	pDC->SelectObject(m_SkinAttribute.m_brBackGround);
	if (m_bMaxSize==true) rcDrawRect.DeflateRect(3,3,3,2);
	else rcDrawRect.DeflateRect(3,4,2,4);
	pDC->RoundRect(&rcDrawRect,CPoint(8,8));

	//清理资源
	pDC->SelectObject(pOldPen);
	BorderPen.DeleteObject();

	return ;
}
Ejemplo n.º 2
0
//绘画函数
void CShortMessage::OnPaint()
{
	CPaintDC dc(this); 

	//绘画标题
	DrawCaption(&dc);

	CRect ClientRect;
	GetClientRect(&ClientRect);
	int nXExcursion=GetXExcursionPos();
	int nYExcursion=GetYExcursionPos();

	//绘画背景
	COLORREF Color = RGB(170,213,244);
	dc.FillSolidRect(nXExcursion,nYExcursion,ClientRect.Width()-2*nXExcursion,4,Color);
	dc.FillSolidRect(nXExcursion,ClientRect.Height()-8,ClientRect.Width()-2*nXExcursion,7,Color);
	dc.FillSolidRect(nXExcursion,nYExcursion+4,12,ClientRect.Height()-nYExcursion-9,Color);
	dc.FillSolidRect(ClientRect.Width()-nXExcursion-12,nYExcursion+4,12,ClientRect.Height()-nYExcursion-9,Color);
	CRect mRect(nXExcursion,190,ClientRect.Width()-2*nXExcursion,ClientRect.Height());
	CBrush Brush(Color); 
	dc.FillRect(mRect,&Brush);

	//创建笔画
	CPen BorderPen(PS_SOLID,1,RGB(20,20,20));
	CPen * pOldPen=dc.SelectObject(&BorderPen);
	dc.SelectObject(m_SkinAttribute.m_brBackGround);

	//绘画内框
	CRect rcDrawRect(nXExcursion,nYExcursion,ClientRect.Width()-2*nXExcursion,200);
	rcDrawRect.DeflateRect(6,4,6,4);
	dc.RoundRect(&rcDrawRect,CPoint(8,8));

	//清理资源
	dc.SelectObject(pOldPen);
	BorderPen.DeleteObject();

	//创建笔画
	CPen BorderPen1(PS_SOLID,1,m_SkinAttribute.m_crInsideBorder);
	pOldPen=dc.SelectObject(&BorderPen1);

	//绘画内框
	rcDrawRect.DeflateRect(1,1,1,1);
	dc.RoundRect(&rcDrawRect,CPoint(8,8));
	CRect rcDrawRect1(nXExcursion+9,203,ClientRect.Width()-2*nXExcursion-8,ClientRect.Height()-37);
	dc.RoundRect(&rcDrawRect1,CPoint(4,4));

	//清理资源
	dc.SelectObject(pOldPen);
	BorderPen1.DeleteObject();

	return;
}
void CHSBControlColor::Paint(Gdiplus::Graphics *pGraphics)
{
	SolidBrush backBrush(ColorDefined[m_index]);
	pGraphics->FillRectangle(&backBrush, m_Left + 1, m_Top + 1, 24, 18);
	if (m_Fouced)
	{
		Pen BorderPen1(0xFFF29436);
		Pen BorderPen2(0xFFFFE294);
		pGraphics->DrawRectangle(&BorderPen1, m_Left, m_Top, 24 + 1, 18 + 1);
		pGraphics->DrawRectangle(&BorderPen2, m_Left + 1, m_Top + 1, 24 - 1, 18 - 1);
	}
	else
	{
		Pen BorderPen(0xFF828790, 1);	
		pGraphics->DrawRectangle(&BorderPen, m_Left, m_Top, 24 + 1, 18 + 1);
	}
}
Ejemplo n.º 4
0
void QGraph::DrawGraph(QPainter &painter)
{
	static QColor color;
	painter.save();

//	Paint background
//	QBrush bg(m_BkColor);
//	painter.setBackground(bg);

//	Draw Border
	if(m_bBorder) color = m_BorderColor;
	else          color = m_BkColor;
	QPen BorderPen(color);
	BorderPen.setStyle(GetStyle(m_BorderStyle));
	BorderPen.setWidth(m_BorderWidth);

	painter.setPen(BorderPen);
	painter.fillRect(m_rCltRect, m_BkColor);
	painter.drawRect(m_rCltRect);
	Init();

	painter.setClipRect(m_rCltRect);

	painter.setBackgroundMode(Qt::TransparentMode);

	if(m_bXMinGrid) DrawXMinGrid(painter);
	if(m_bYMinGrid) DrawYMinGrid(painter);
	if(m_bXMajGrid) DrawXMajGrid(painter);
	if(m_bYMajGrid) DrawYMajGrid(painter);

	DrawAxes(painter);

	DrawXTicks(painter);

	DrawYTicks(painter);

	for (int nc=0; nc < m_oaCurves.size(); nc++)	DrawCurve(nc,painter);

	DrawTitles(painter);

	painter.setClipping(false);
	painter.restore();
}
Ejemplo n.º 5
0
void CToolTipWnd::DrawTipWnd(CDC *pDC,const RECT& rcClient)
{
	CRect rcWnd = rcClient;
	pDC->FillSolidRect(&rcClient,m_crBackGnd);
	CPen BorderPen(PS_SOLID,1,RGB(0,0,255)); 
	CPen *pOldPen = (CPen *)pDC->SelectObject(&BorderPen);
	pDC->SelectStockObject(NULL_BRUSH);
	pDC->Rectangle(rcWnd);
	BorderPen.DeleteObject();

	rcWnd.DeflateRect(1,1,1,1);

	CFont *pOldFont = (CFont *)pDC->SelectStockObject(DEFAULT_GUI_FONT);
	COLORREF crOTxt = pDC->SetTextColor(m_crText);
	int mode = pDC->SetBkMode(TRANSPARENT);
	pDC->DrawText(m_strCurTipText,&rcWnd,DT_CENTER|DT_SINGLELINE|DT_VCENTER);
	pDC->SetBkMode(mode);
	pDC->SetTextColor(crOTxt);
	pDC->SelectObject(pOldFont);
}
Ejemplo n.º 6
0
//重画消息
void CDlgLogon::OnPaint()
{
	CPaintDC dc(this);

	//获取位置
	CRect ClientRect;
	GetClientRect(&ClientRect);

	//绘画标题
	DrawSkinView(&dc);

	//绘画背景
	int nXExcursion=GetXExcursionPos();
	int nYExcursion=GetYExcursionPos();
	dc.FillSolidRect(nXExcursion,nYExcursion,ClientRect.Width()-2*nXExcursion,4,m_SkinAttribute.m_crBackFrame);
	dc.FillSolidRect(nXExcursion,ClientRect.Height()-8,ClientRect.Width()-2*nXExcursion,7,m_SkinAttribute.m_crBackFrame);
	dc.FillSolidRect(nXExcursion,nYExcursion+4,12,ClientRect.Height()-nYExcursion-9,m_SkinAttribute.m_crBackFrame);
	dc.FillSolidRect(ClientRect.Width()-nXExcursion-12,nYExcursion+4,12,ClientRect.Height()-nYExcursion-9,m_SkinAttribute.m_crBackFrame);
	dc.FillSolidRect(nXExcursion,119,ClientRect.Width()-2*nXExcursion,5,m_SkinAttribute.m_crBackFrame);

	//创建画笔
	CPen BorderPen(PS_SOLID,1,m_SkinAttribute.m_crInsideBorder);
	CPen * pOldPen=dc.SelectObject(&BorderPen);
	dc.SelectObject(m_SkinAttribute.m_brBackGround);

	//绘画内框
	CRect rcDrawRect(nXExcursion,nYExcursion,ClientRect.Width()-2*nXExcursion,ClientRect.Height());
	if (m_bMaxSize==true) rcDrawRect.DeflateRect(3,3,3,2);
	else rcDrawRect.DeflateRect(3,4,2,4);
	rcDrawRect.top=123;
	if(m_bNetOption)rcDrawRect.bottom=368;
	else rcDrawRect.bottom=284;
	dc.RoundRect(&rcDrawRect,CPoint(8,8));

	//释放资源
	dc.SelectObject(pOldPen);
	BorderPen.DeleteObject();

	return;
}
void CHSBControlBar::Paint(Gdiplus::Graphics *pGraphics)
{
	Pen BorderPen(0xFF828790, 1);
	pGraphics->DrawImage(&m_Bitmap, m_Left + 1, m_Top + 1);
	pGraphics->DrawRectangle(&BorderPen, m_Left, m_Top, 256 + 1, COLOR_BAR_HEIGHT + 1);
}
void CHSBControlColors::Paint(Gdiplus::Graphics *pGraphics)
{
	Pen BorderPen(0xFF828790, 1);
	pGraphics->DrawImage(&m_Bitmap, m_Left + 1, m_Top + 1);
	pGraphics->DrawRectangle(&BorderPen, m_Left, m_Top, COLOR_MAP_WIDTH + 1, 256 + 1);
}
void QSideViewImageWidget::paintEvent(QPaintEvent */*evt*/)
{
    QPainter dc;
    dc.begin( this );

    QRect rcClient( 0,0,width()-1,height()-1 );

    QPen BorderPen( QColor(84, 109, 142) );
    BorderPen.setWidth( 2 );

    if( m_nProgress == 100 )
    {
        dc.setPen( BorderPen );
        dc.drawRect( rcClient );
    }
    else
    {
        dc.setPen( Qt::lightGray );
        dc.drawRect( rcClient );
    }

    dc.setPen( Qt::black );
    rcClient.adjust( 1, 1, -1, -1 );

    if( m_bmpImage && !m_bmpImage->isNull() )
    {
        dc.drawImage( rcClient, *m_bmpImage );

        // draw split-line
        if( !m_bNoCam && m_nOrignImageHeight != 0 )
        {
            int nStep = m_nOrignImageHeight;
            float fStepH = (float)rcClient.height() / nStep;
            if( fStepH >= 2.f )
            {
                for( int i=1 ; i<nStep ; i++ )
                {
                    if( i == (nStep/2) || i == (nStep/2+1) ) continue;
                    int nY = (int)(rcClient.top() + i*fStepH + .5f);
                    dc.drawLine( rcClient.left(), nY, rcClient.right(), nY );
                }
            }

            int nY1 = (int)(rcClient.top() + (nStep/2)*fStepH + .5f);
            int nY2 = (int)(rcClient.top() + (nStep/2+2)*fStepH + .5f);
            int nYC = (int)(rcClient.top() + (nStep/2+1)*fStepH + .5f);

            dc.setPen( Qt::black );
            dc.drawLine( rcClient.left(), nYC, rcClient.right(), nYC );
            dc.drawLine( rcClient.left(), nY1, rcClient.right(), nY1 );

            dc.setPen( QColor(255,50,50) );

            int nDrawY = 0;
            int nDrawH = 0;

            if( m_strModelName.compare( "T3000" ) == 0 ||
                m_strModelName.compare( "C3000" ) == 0 )
            {
                nDrawY = nY1;
                nDrawH = (nY2-nY1);
                dc.drawRect( rcClient.left(), nDrawY, rcClient.width(), nDrawH );
            }
            else
            {
                if( m_bSimpleDetection )
                {
                    nDrawY = nY1;
                    nDrawH = (nYC-nY1);
                    dc.drawRect( rcClient.left(), nDrawY, rcClient.width(), nDrawH );
                }
                else
                {
                    nDrawY = nY1 - fStepH + .5f;
                    nDrawH = (nY2-nY1) + fStepH + .5f;
                    dc.drawRect( rcClient.left(), nDrawY, rcClient.width(), nDrawH );
                }
            }

            if( m_nAutoLine > 0 )
            {
                dc.setPen( Qt::cyan );
                dc.drawRect( rcClient.left(), nDrawY+(int)((m_nAutoLine*fStepH)+.5f), rcClient.width(), nDrawH );
            }
        }
    }
    else
    {
        QString str( text() );

        dc.fillRect( rcClient, Qt::black );

        dc.setPen( Qt::white );
        dc.drawText( rcClient, str, QTextOption( Qt::AlignVCenter | Qt::AlignHCenter ) );
    }

    dc.end();
}
Ejemplo n.º 10
0
void CChartPointsSerie::Draw(CDC *pDC)
{
	if (!m_bIsVisible)
		return;
	if (!pDC->GetSafeHdc())
		return;

	CBrush NewBrush(m_SerieColor);
	CPen BorderPen(PS_SOLID, 1, m_colBorder);
	CBrush ShadowBrush(m_ShadowColor);
	CPen ShadowPen(PS_SOLID, 1, m_ShadowColor);
	CPen* pOldPen = pDC->SelectObject(&BorderPen);
	CBrush* pOldBrush = pDC->SelectObject(&NewBrush);

	pDC->SetBkMode(TRANSPARENT);
	//To have lines limited in the drawing rectangle :
	pDC->IntersectClipRect(m_PlottingRect);

	//Draw all points that haven't been drawn yet
	for (m_uLastDrawnPoint;m_uLastDrawnPoint<(int)GetPointsCount();m_uLastDrawnPoint++)
	{
		SChartXYPoint Point = GetPoint(m_uLastDrawnPoint);
		CPoint ScreenPoint;
		ValueToScreen(Point.X, Point.Y, ScreenPoint);

		CRect PointRect;
		PointRect.SetRect(ScreenPoint.x-m_iXPointSize/2,ScreenPoint.y-m_iYPointSize/2,ScreenPoint.x+m_iXPointSize/2,ScreenPoint.y+m_iYPointSize/2);
		CRect ShadowRect = PointRect + CSize(m_iShadowDepth,m_iShadowDepth);

		switch(m_iPointType)
		{
		case ptEllipse:
			if (m_bShadow)
			{
				pOldPen = pDC->SelectObject(&ShadowPen);
				pDC->SelectObject(&ShadowBrush);
				pDC->Ellipse(ShadowRect);
				pDC->SelectObject(&NewBrush);
				pDC->SelectObject(&BorderPen);
			}
			pDC->Ellipse(PointRect);
			break;

		case ptRectangle:
			if (m_bShadow)
			{
				pOldPen = pDC->SelectObject(&ShadowPen);
				pDC->SelectObject(&ShadowBrush);
				pDC->Rectangle(ShadowRect);
				pDC->SelectObject(&NewBrush);
				pDC->SelectObject(&BorderPen);
			}
			pDC->Rectangle(PointRect);
			break;

		case ptTriangle:
			{
				CPoint TrPoints[3];
				TrPoints[0].x = PointRect.left;
				TrPoints[0].y = PointRect.bottom;
				TrPoints[1].x = PointRect.right;
				TrPoints[1].y = PointRect.bottom;
				TrPoints[2].x = PointRect.left + (int)fabs((PointRect.left-PointRect.right)/2.0);
				TrPoints[2].y = PointRect.top;

				if (m_bShadow)
				{
					CPoint ShadowPoints[3];
					for (int i=0;i<3;i++)
					{
						ShadowPoints[i] = TrPoints[i] + CSize(m_iShadowDepth,m_iShadowDepth);
					}

					pOldPen = pDC->SelectObject(&ShadowPen);
					pDC->SelectObject(&ShadowBrush);
					pDC->Polygon(ShadowPoints,3);
					pDC->SelectObject(&NewBrush);
					pDC->SelectObject(&BorderPen);
				}
				pDC->Polygon(TrPoints,3);
			}
			break;
		}

	}

	pDC->SelectClipRgn(NULL);
	pDC->SelectObject(pOldPen);
	pDC->SelectObject(pOldBrush);
	DeleteObject(BorderPen);
	DeleteObject(NewBrush);
	DeleteObject(ShadowBrush);
	DeleteObject(ShadowPen);
}
Ejemplo n.º 11
0
//绘画函数
void CShortMessage::OnPaint()
{
	CPaintDC dc(this); 

	//绘画标题
	DrawCaption(&dc);

	CRect ClientRect;
	GetClientRect(&ClientRect);
	int nXExcursion=GetXExcursionPos();
	int nYExcursion=GetYExcursionPos();

	/////////////////////////////////////////////////////////////////////////////
	CRect rcClient1;
	GetWindowRect(&rcClient1);
	int nWidth1=rcClient1.Width();
	int nHeight1=rcClient1.Height();
	//调整判断
	if ((nWidth1!=0)&&(nHeight1!=0))
	{
		//框架位置
		CRect rcFrame;
		rcFrame.SetRect(0,0,nWidth1,nHeight1);

		//窗口区域
		CRgn RegionWindow;
		RegionWindow.CreateRoundRectRgn(rcFrame.left,rcFrame.top,rcFrame.right+1,rcFrame.bottom+1,5,5);

		//设置区域
		SetWindowRgn(RegionWindow,TRUE);
	}
	///////////////////////////////////////////////////////////////////////////

	//绘画背景
	COLORREF Color = RGB(170,213,244);
	dc.FillSolidRect(nXExcursion,nYExcursion,ClientRect.Width()-2*nXExcursion,4,Color);
	dc.FillSolidRect(nXExcursion,ClientRect.Height()-8,ClientRect.Width()-2*nXExcursion,7,Color);
	dc.FillSolidRect(nXExcursion,nYExcursion+4,12,ClientRect.Height()-nYExcursion-9,Color);
	dc.FillSolidRect(ClientRect.Width()-nXExcursion-12,nYExcursion+4,12,ClientRect.Height()-nYExcursion-9,Color);
	CRect mRect(nXExcursion,190,ClientRect.Width()-2*nXExcursion,ClientRect.Height());
	CBrush Brush(Color); 
	dc.FillRect(mRect,&Brush);

	//创建笔画
	CPen BorderPen(PS_SOLID,1,RGB(20,20,20));
	CPen * pOldPen=dc.SelectObject(&BorderPen);
	dc.SelectObject(m_SkinAttribute.m_brBackGround);

	//绘画内框
	CRect rcDrawRect(nXExcursion,nYExcursion,ClientRect.Width()-2*nXExcursion,200);
	rcDrawRect.DeflateRect(6,4,6,4);
	dc.RoundRect(&rcDrawRect,CPoint(8,8));

	//清理资源
	dc.SelectObject(pOldPen);
	BorderPen.DeleteObject();

	//创建笔画
	CPen BorderPen1(PS_SOLID,1,m_SkinAttribute.m_crInsideBorder);
	pOldPen=dc.SelectObject(&BorderPen1);

	//绘画内框
	rcDrawRect.DeflateRect(1,1,1,1);
	dc.RoundRect(&rcDrawRect,CPoint(8,8));
	CRect rcDrawRect1(nXExcursion+9,203,ClientRect.Width()-2*nXExcursion-8,ClientRect.Height()-37);
	dc.RoundRect(&rcDrawRect1,CPoint(4,4));

	//清理资源
	dc.SelectObject(pOldPen);
	BorderPen1.DeleteObject();

	return;
}
Ejemplo n.º 12
0
//重画消息
void CButtonBar::OnPaint()
{
	CPaintDC dc(this);

	//获取位置
	CRect rcRect;
	GetClientRect(&rcRect);

	//加载资源
	CImageHandle ImageHotHandle(&m_ImageHot);
	CImageHandle ImageActiveHandle(&m_ImageActive);
	CImageHandle ImageNormalHandle(&m_ImageNormal);
	CImageHandle m_ImageBackGroundHandle(&m_ImageBackGround);

	//建立缓冲
	CDC BufferDC;
	CBitmap BufferBmp;
	BufferDC.CreateCompatibleDC(&dc);
	BufferBmp.CreateCompatibleBitmap(&dc,rcRect.Width(),rcRect.Height());
	BufferDC.SelectObject(&BufferBmp);

	//绘画背景
	CBrush BackBrush(TITLE_GROUND_COLOR);
	CPen BorderPen(PS_SOLID,1,CSkinWndObject::m_SkinAttribute.m_crInsideBorder);
	CPen * pOldPen=BufferDC.SelectObject(&BorderPen);
	CBrush * pOldBrush=BufferDC.SelectObject(&BackBrush);
	BufferDC.FillSolidRect(&rcRect,CSkinWndObject::m_SkinAttribute.m_crBackGround);
	BufferDC.RoundRect(&rcRect,CPoint(10,10));
	m_ImageBackGround.BitBlt(BufferDC,1,rcRect.Height()-m_ImageBackGround.GetHeight()-3);
	BufferDC.SelectObject(pOldPen);
	BufferDC.SelectObject(pOldBrush);
	BackBrush.DeleteObject();
	BorderPen.DeleteObject();

	//绘画按钮
	BufferDC.SetBkMode(TRANSPARENT);
	BufferDC.SelectObject(&CSkinAttribute::m_DefaultFont);

	//绘画按钮
	CRect rcButton;
	CSkinImage * pSkinImage=NULL;
	for (INT_PTR i=0;i<m_OptionsItemPtr.GetCount();i++)
	{
		LPCTSTR pszButtonText=m_OptionsItemPtr[i]->GetButtonText();
		rcButton.SetRect(1,(int)(ITEM_HEIGHT*i+10+2*i),rcRect.Width(),(int)(ITEM_HEIGHT*(i+1)+10+2*i));
		if (i==m_nActiveItem) 
		{
			pSkinImage=&m_ImageActive;
			BufferDC.SetTextColor(RGB(0,0,0));
		}
		else if (i==m_nHotItem) 
		{
			pSkinImage=&m_ImageHot;
			BufferDC.SetTextColor(RGB(0,0,0));
		}
		else 
		{
			pSkinImage=&m_ImageNormal;
			BufferDC.SetTextColor(RGB(0,0,0));
		}
		pSkinImage->BitBlt(BufferDC,rcButton.left,rcButton.top,ITEM_WIDTH,ITEM_HEIGHT,0,0,SRCCOPY);
		BufferDC.DrawText(pszButtonText,lstrlen(pszButtonText),rcButton,DT_END_ELLIPSIS|DT_VCENTER|DT_CENTER|DT_SINGLELINE);
	}

	//绘画界面
	dc.BitBlt(0,0,rcRect.Width(),rcRect.Height(),&BufferDC,0,0,SRCCOPY);

	//清理资源
	BufferDC.DeleteDC();
	BufferBmp.DeleteObject();

	return;
}
Ejemplo n.º 13
0
//绘画函数
void CDlgCustomFace::OnPaint()
{
	CPaintDC dc(this);

	//获取位置
	CRect rcRect;
	GetClientRect(&rcRect);
	int nXExcursion=GetXExcursionPos();
	int nYExcursion=GetYExcursionPos();

	//绘画内框
	CPen BorderPen(PS_SOLID,1,m_SkinAttribute.m_crInsideBorder);
	CPen * pOldPen=dc.SelectObject(&BorderPen);
	CRect rcDrawRect(nXExcursion,nYExcursion,rcRect.Width()-2*nXExcursion,rcRect.Height());
	dc.SelectObject(m_SkinAttribute.m_brBackGround);
	if (m_bMaxSize==true) rcDrawRect.DeflateRect(3,3,3,2);
	else rcDrawRect.DeflateRect(3,4,3,4);
	dc.RoundRect(&rcDrawRect,CPoint(8,8));
	dc.SelectObject(pOldPen);
	BorderPen.DeleteObject();

	//绘画边框
	CRect rcSmallFace(SMALL_FRAME_LEFT-FRAME_SPACE, SMALL_FRAME_TOP-FRAME_SPACE, SMALL_FRAME_RIGHT+FRAME_SPACE, SMALL_FRAME_BOTTOM+FRAME_SPACE);
	dc.Draw3dRect(rcSmallFace, FRAME_TL_COLOR1, FRAME_RB_COLOR1);
	rcSmallFace.DeflateRect(1,1,1,1);
	dc.Draw3dRect(rcSmallFace, FRAME_TL_COLOR2, FRAME_RB_COLOR2);

	//绘画边框
	CRect rcLargeFace(LARGE_FRAME_LEFT-FRAME_SPACE, LARGE_FRAME_TOP-FRAME_SPACE, LARGE_FRAME_RIGHT+FRAME_SPACE, LARGE_FRAME_BOTTOM+FRAME_SPACE);
	dc.Draw3dRect(rcLargeFace, FRAME_TL_COLOR1, FRAME_RB_COLOR1);
	rcLargeFace.DeflateRect(1,1,1,1);
	dc.Draw3dRect(rcLargeFace, FRAME_TL_COLOR2, FRAME_RB_COLOR2);

	//绘画头像
	tagGlobalUserData &GlobalUserData = g_GlobalUnits.GetGolbalUserData();
	if ( !m_Image.IsNull() )
	{
		CDC *pDC = GetDC() ;

		//窗体大小
		CRect rcSmallFace(SMALL_FRAME_LEFT, SMALL_FRAME_TOP, SMALL_FRAME_RIGHT, SMALL_FRAME_BOTTOM);
		CRect rcLargeFace(LARGE_FRAME_LEFT, LARGE_FRAME_TOP, LARGE_FRAME_RIGHT, LARGE_FRAME_BOTTOM);

		//设置模式
		dc.SetStretchBltMode(HALFTONE);

		//绘画图片
		m_Image.StretchBlt(dc.GetSafeHdc(), rcSmallFace);
		m_Image.StretchBlt(dc.GetSafeHdc(), rcLargeFace);

		
		//释放资源
		ReleaseDC(pDC);
	}
	else if(GlobalUserData.dwUserID!=0 && GlobalUserData.dwCustomFaceVer!=0)
	{
		CDC *pDC = GetDC() ;
		g_GlobalUnits.m_UserFaceRes->DrawNormalFace(pDC,SMALL_FRAME_LEFT,SMALL_FRAME_TOP,
			GlobalUserData.wFaceID,GlobalUserData.dwUserID,GlobalUserData.dwCustomFaceVer,32,32);

		g_GlobalUnits.m_UserFaceRes->DrawCustomBigFace(pDC,LARGE_FRAME_LEFT,LARGE_FRAME_TOP,
			GlobalUserData.dwUserID,GlobalUserData.dwCustomFaceVer);

		//释放资源
		ReleaseDC(pDC);
			
	}

	
	//绘画标题
	__super::DrawSkinView(&dc);
}
Ejemplo n.º 14
0
void CGradientProgressCtrl::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	if(m_nCurrentPosition<=m_nLower||m_nCurrentPosition>=m_nUpper)
	{
		CRect rect;
		GetClientRect(rect);
		CBrush brush;
		brush.CreateSolidBrush(::GetSysColor(COLOR_3DFACE));
		dc.FillRect(&rect,&brush);
		VERIFY(brush.DeleteObject());
		return;
	}
	CRect rectClient;
	GetClientRect(rectClient);
	float maxWidth((float)m_nCurrentPosition/(float)m_nUpper*(float)rectClient.right);
/*	//绘制
	DrawGradient(&dc,rectClient,(int)maxWidth);
	//显示进程条进度文字
	if(m_bShowPercent)
	{
		CString percent;
		percent.Format("%d%%",(int)(100*(float)m_nCurrentPosition/m_nUpper));
		dc.SetTextColor(m_clrText);
		dc.SetBkMode(TRANSPARENT);
		dc.DrawText(percent,&rectClient,DT_VCENTER|DT_CENTER|DT_SINGLELINE);
	}
*/
	// Do not call CProgressCtrl::OnPaint() for painting messages
	/////////////////////////////
    
	CPen * pWhitePen=CPen::FromHandle((HPEN)GetStockObject(WHITE_PEN));
//	CPen * pBlackPen=CPen::FromHandle((HPEN)GetStockObject(BLACK_PEN));

	dc.SelectObject(pWhitePen);
	//创建笔画
	CPen BorderPen1(PS_SOLID,1, RGB( 0xff, 0xcf, 0xa7) );
	CPen * pOldPen1= dc.SelectObject(&BorderPen1);

	CBrush brush,*oldbrush;
	CBrush brush1;

	brush1.CreateSolidBrush(RGB( 0xff, 0xcf, 0xa7));

	oldbrush=dc.SelectObject(&brush1);
	dc.Rectangle( 0, 0, rectClient.right, rectClient.bottom);
	dc.SelectObject(oldbrush);
	dc.SelectObject(pOldPen1);
	BorderPen1.DeleteObject();

	brush.CreateSolidBrush(RGB(255,255,255));		// 白色
	oldbrush=dc.SelectObject(&brush);
	dc.Ellipse( 0, 0, rectClient.bottom, rectClient.bottom);
	dc.Ellipse( rectClient.right - rectClient.Height(), 0, rectClient.right, rectClient.bottom);
	dc.Rectangle( rectClient.Height()/2, 0, rectClient.right - rectClient.Height()/2, rectClient.bottom);

	dc.SelectObject(oldbrush);

//	CBrush brush2;
//--------------------------------------

	if ( maxWidth > rectClient.Height())
	{
	//	CPen * pRedPen=CPen::FromHandle((HPEN)GetStockObject(DKGRAY_BRUSH));
		//创建笔画
		CPen BorderPen(PS_SOLID,1, RGB(128, 0, 0) );
		CPen * pOldPen= dc.SelectObject(&BorderPen);

//		dc.SelectObject(pRedPen);
		CBrush brush2;
		brush2.CreateSolidBrush(RGB(128, 0, 0));
		oldbrush=dc.SelectObject(&brush2);
		dc.Ellipse( 0, 0, rectClient.bottom, rectClient.bottom);
		dc.Rectangle( rectClient.Height()/2, 0, maxWidth, rectClient.bottom);
		dc.SelectObject(oldbrush);
		
		//清理资源
		VERIFY(brush2.DeleteObject());
		dc.SelectObject(pOldPen);
		BorderPen.DeleteObject();
	}
//--------------------------------------
	VERIFY(brush1.DeleteObject());
	VERIFY(brush.DeleteObject());

}
Ejemplo n.º 15
0
//绘画函数
VOID CUserInfoView::OnPaint()
{
	CPaintDC dc(this);

	//获取位置
	CRect rcClient;
	GetClientRect(&rcClient);

	//建立缓冲
	CDC BufferDC;
	CBitmap ImageBuffer;
	BufferDC.CreateCompatibleDC(&dc);
	ImageBuffer.CreateCompatibleBitmap(&dc,rcClient.Width(),rcClient.Height());

	//设置 DC
	BufferDC.SetBkMode(TRANSPARENT);
	BufferDC.SelectObject(&ImageBuffer);
	BufferDC.SetTextColor(RGB(0,0,0));

	//填充背景
	BufferDC.FillSolidRect(&rcClient,COLOR_VIEW_BACKGROUND);

	//绘画边框
	CRect rcPhotoFram(PHOTO_FRAME_EXCURSION_X, PHOTO_FRAME_EXCURSION_Y, PHOTO_FRAME_EXCURSION_X+PHOTO_FRAME_WIDTH, PHOTO_FRAME_EXCURSION_Y+PHOTO_FRAME_HEIGHT);
	CPen BorderPen(PS_SOLID,2,COLOR_PHOTO_FRAM);
	CPen * pOldPen=BufferDC.SelectObject(&BorderPen);
	BufferDC.RoundRect(&rcPhotoFram,CPoint(0,00));
	BufferDC.SelectObject(pOldPen);

	//创建字体
	CFont Font;
	VERIFY(Font.CreateFont(12,0,0,0,FW_NORMAL,FALSE,FALSE,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH | FF_SWISS,TEXT("宋体")));             

	CFont *pOldFont = BufferDC.SelectObject(&Font);

	//绘画用户
	if (m_pCurrentUserData!=NULL)
	{
		//变量定义
		TCHAR szString[256]=TEXT("");
		tagServerAttribute const* pGameAttribute=m_pIClientKernel->GetServerAttribute();

		//绘画标识
		if ( m_pCurrentUserData->dwCustomFaceVer == 0 )
		{
			//设置大小
			rcPhotoFram.DeflateRect(1, 1, 2, 2);

			if ( m_pCurrentUserData->cbGender != 2 )
			{
				CImageHandle ImageHandleMaleFace(&m_ImageMaleFace);
				m_ImageMaleFace.BitBlt(BufferDC.GetSafeHdc(), rcPhotoFram.left, rcPhotoFram.top);
			}
			else
			{
				CImageHandle ImageHandleFemaleFace(&m_ImageFemaleFace);
				m_ImageFemaleFace.BitBlt(BufferDC.GetSafeHdc(), rcPhotoFram.left, rcPhotoFram.top);
			}
		}
		//用户头像
		else
		{
			ASSERT(m_pIUserFaceRes!=NULL);
			m_pIUserFaceRes->DrawCustomBigFace(&BufferDC,rcPhotoFram.left+1, rcPhotoFram.top+1,m_pCurrentUserData->dwUserID,m_pCurrentUserData->dwCustomFaceVer);
		}

		//用户属性
		INT nUserInfoCuont = 6;
		const tagUserData *pMeUserData = m_pIClientKernel->GetMeUserInfo();
		if(pMeUserData!=NULL && m_pCurrentUserData->dwUserID==pMeUserData->dwUserID)
			nUserInfoCuont++;
		for (INT i=0;i<nUserInfoCuont;i++)
		{
			//位置定义
			CRect rcString;
			rcString.SetRect(PHOTO_FRAME_EXCURSION_X+PHOTO_FRAME_WIDTH+10,6+i*20,rcClient.Width()-5,6+i*20+15);

			TCHAR szString[128];

			//绘画信息
			switch (i)
			{
			case 0:		//用户帐号
				{
					//用户帐号
					_sntprintf(szString,CountArray(szString),TEXT("用户名:%s"),m_pCurrentUserData->szName);
					BufferDC.DrawText(szString,lstrlen(szString),&rcString,DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

					break;
				}
			case 1:
				{
					//输出信息
					if ( m_pCurrentUserData->cbGender == 0 ) 
						_sntprintf(szString,CountArray(szString),TEXT("性别:保密"));
					else if ( m_pCurrentUserData->cbGender == 1 ) 
						_sntprintf(szString,CountArray(szString),TEXT("性别:男"));
					else _sntprintf(szString,CountArray(szString),TEXT("性别:女"));
					BufferDC.DrawText(szString,lstrlen(szString),&rcString,DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

					break;
				}
			case 2:
				{
					BufferDC.SetTextColor(RGB(255,0,0));
					//输出信息
					_sntprintf(szString,CountArray(szString),TEXT("魅力:%ld"),m_pCurrentUserData->lLoveliness);
					BufferDC.DrawText(szString,lstrlen(szString),&rcString,DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

					BufferDC.SetTextColor(RGB(0,0,0));

					break;
				}
			case 3:
				{
					//输出信息
					if ( pGameAttribute->wGameGenre == GAME_GENRE_GOLD )
						_sntprintf(szString,CountArray(szString),TEXT("游戏币:%ld"),m_pCurrentUserData->lScore);
					else if (pGameAttribute->wGameGenre == GAME_GENRE_EDUCATE)
						_sntprintf(szString,CountArray(szString),TEXT("练习币:%ld"),m_pCurrentUserData->lScore);
					else if (pGameAttribute->wGameGenre == GAME_GENRE_MATCH)
						_sntprintf(szString,CountArray(szString),TEXT("赛币:%ld"),m_pCurrentUserData->lScore);
					else
						_sntprintf(szString,CountArray(szString),TEXT("积分:%ld"),m_pCurrentUserData->lScore);
					BufferDC.DrawText(szString,lstrlen(szString),&rcString,DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

					break;
				}
			case 4:
				{
					CGameFrameControl *pGameFrameControl= (CGameFrameControl *)GetParent();
					CUserListView &UserListView = pGameFrameControl->m_UserListView;

					//输出信息
					_sntprintf(szString,CountArray(szString),TEXT("游戏级别:%s"),
						UserListView.m_GameRankManagerHelper->GetLevelDescribe(m_pCurrentUserData->lScore));
					BufferDC.DrawText(szString,lstrlen(szString),&rcString,DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

					break;
				}
			case 5:
				{
					CGameFrameControl *pGameFrameControl= (CGameFrameControl *)GetParent();
					CUserListView &UserListView = pGameFrameControl->m_UserListView;

					//会员信息
					LPCTSTR pszMemberOrder[]={TEXT("非会员"),TEXT("红钻会员"),TEXT("蓝钻会员"),TEXT("黄钻会员"),TEXT("紫钻会员")};
					if (m_pCurrentUserData->cbMemberOrder>=CountArray(pszMemberOrder))break;

					//输出信息
					_sntprintf(szString,CountArray(szString),TEXT("会员级别:%s"),pszMemberOrder[m_pCurrentUserData->cbMemberOrder]);
					BufferDC.DrawText(szString,lstrlen(szString),&rcString,DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

					break;
				}
			case 6:
				{
					//输出信息
					_sntprintf(szString,CountArray(szString),TEXT("银行存款:%ld"),m_pCurrentUserData->lInsureScore);
					BufferDC.DrawText(szString,lstrlen(szString),&rcString,DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

					break;
				}
			}
		}

		//魅力数目
		BufferDC.SetTextColor(RGB(255,0,0));
		CRect rcExchange;
		m_btExchange.GetWindowRect(rcExchange);
		ScreenToClient(rcExchange);
		CString strFlowerCount;
		strFlowerCount.Format(TEXT("%ld"), m_pCurrentUserData->lLoveliness);
		BufferDC.TextOut(rcExchange.right+4, rcExchange.top+4, strFlowerCount);
	}

	//绘画界面
	dc.BitBlt(0,0,rcClient.Width(),rcClient.Height(),&BufferDC,0,0,SRCCOPY);

	//清理资源	
	BufferDC.SelectObject(pOldFont);
	BufferDC.DeleteDC();
	ImageBuffer.DeleteObject();	
	Font.DeleteObject();

	return;
}
Ejemplo n.º 16
0
//
// Called by LKDrawLook8000, this is what happens when we change mapspace mode, advancing through types.
// We paint infopages, nearest, tri, etc.etc.
// Normally there is plenty of cpu available because the map is not even calculated.
// This is why we bring to the Draw thread, in the nearest pages case, also calculations.
//
void MapWindow::DrawMapSpace(LKSurface& Surface,  const RECT& rc) {

  BrushReference hB;

  TextInBoxMode_t TextDisplayMode = {0};
  TCHAR Buffer[LKSIZEBUFFERLARGE*2];
#ifdef DRAWLKSTATUS
  bool dodrawlkstatus=false;
#endif


#ifndef DITHER
  if (MapSpaceMode==MSM_WELCOME) {
	if (INVERTCOLORS)
		hB=LKBrush_Petrol;
	  else
		hB=LKBrush_Mlight;
  } else {
	if (INVERTCOLORS)
	  hB=LKBrush_Mdark;
	else
	  hB=LKBrush_Mlight;

  }
#else
  if (INVERTCOLORS)
      hB=LKBrush_Black;
  else
      hB=LKBrush_White;
#endif

  const auto oldfont = Surface.SelectObject(LKINFOFONT); // save font
  if (MapSpaceMode==MSM_WELCOME) {
      LKBitmap WelcomeBitmap = LoadSplash(_T("LKPROFILE"));
      if(WelcomeBitmap) {
          DrawSplash(Surface, WelcomeBitmap);
      }
  } else {
      Surface.FillRect(&rc, hB);
  }

  // Paint borders in green, but only in nearest pages and welcome, and not in DITHER mode
  // In case we want it in dithered mode, some changes are ready to be used.
  #ifndef DITHER
  if (MapSpaceMode==MSM_WELCOME || (!IsMultiMap() && MapSpaceMode!=MSM_MAP) )
  {
     #ifdef DITHER
     LKPen BorderPen(PEN_SOLID, ScreenThinSize, INVERTCOLORS?RGB_WHITE:RGB_BLACK);
     #else
     LKPen BorderPen(PEN_SOLID, ScreenThinSize, INVERTCOLORS?RGB_GREEN:RGB_DARKGREEN);
     #endif
     auto OldPen = Surface.SelectObject(BorderPen);
     auto OldBrush = Surface.SelectObject(LK_HOLLOW_BRUSH);

     Surface.Rectangle(rc.left, rc.top, rc.right, rc.bottom - BottomSize);

     Surface.SelectObject(OldPen);
     Surface.SelectObject(OldBrush);
  }
  #endif


#ifdef DRAWLKSTATUS
  if (LKevent==LKEVENT_NEWRUN) dodrawlkstatus=true;
#endif

  // We are entering mapspacemodes with no initial check on configured subpages.
  // Thus we need to ensure that the page is really available, or find the first valid.
  // However, this will prevent direct customkey access to pages!
  // Instead, we do it when we call next page from InfoPageChange
  // if (!ConfIP[ModeIndex][CURTYPE]) NextModeType();
  switch (MapSpaceMode) {
	case MSM_WELCOME:
#if 0
		SetModeType(LKMODE_MAP,MP_MOVING);
		RefreshMap();
		break;
#endif
#if (1)
		if (!DrawInfo.NAVWarning) {
		static double firsttime=DrawInfo.Time;
		// delayed automatic exit from welcome mode
		if ( DrawInfo.Time > (firsttime+3.0) ) {
			SetModeType(LKMODE_MAP,MP_MOVING);
			LKevent=LKEVENT_NONE;
			LKSound(_T("LK_BEEP1.WAV"));
			RefreshMap();
			break;
		}
		}
#endif
		if(GlobalModelType==MODELTYPE_PNA_MINIMAP)
		{
			SetModeType(LKMODE_MAP,MP_MOVING);
			LKevent=LKEVENT_NONE;
			break;
		}

		DrawWelcome8000(Surface, rc);
		break;
	case MSM_MAPTRK:
		SetSideviewPage(IM_HEADING);
		LKDrawMultimap_Asp(Surface,rc);
		break;
	case MSM_MAPWPT:
		#if 0
		// If there is no destination, force jump to the map
		if (GetOvertargetIndex()<0) {
			SetModeType(LKMODE_MAP,MP_MOVING);
			LKevent=LKEVENT_NONE;
			break;
		}
		#endif
		SetSideviewPage(IM_NEXT_WP);
		LKDrawMultimap_Asp(Surface,rc);
		break;
	case MSM_MAPASP:
		SetSideviewPage(IM_NEAR_AS);
		LKDrawMultimap_Asp(Surface,rc);
		break;
	case MSM_MAPRADAR:
		LKDrawMultimap_Radar(Surface,rc);
		break;
	case MSM_VISUALGLIDE:
		SetSideviewPage(IM_VISUALGLIDE);
		LKDrawMultimap_Asp(Surface,rc);
		break;
	case MSM_MAPTEST:
		LKDrawMultimap_Test(Surface,rc);
		break;
	case MSM_LANDABLE:
	case MSM_NEARTPS:
	case MSM_AIRPORTS:
	case MSM_COMMON:
	case MSM_RECENT:
	case MSM_AIRSPACES:
	case MSM_THERMALS:
	case MSM_TRAFFIC:
		DrawNearest(Surface, rc);
		break;
	case MSM_MAP:
		break;
	case MSM_INFO_THERMAL:
	case MSM_INFO_CRUISE:
	case MSM_INFO_TASK:
	case MSM_INFO_AUX:
	case MSM_INFO_TRI:
	case MSM_INFO_HSI:
	case MSM_INFO_TRF:
	case MSM_INFO_TARGET:
	case MSM_INFO_CONTEST:
		DrawInfoPage(Surface,rc, false);
		break;

  default:
    memset((void*)&TextDisplayMode, 0, sizeof(TextDisplayMode));
    TextDisplayMode.Color = RGB_WHITE;
    TextDisplayMode.NoSetFont = 1;
    TextDisplayMode.AlligneCenter = 1;
    Surface.SelectObject(LK8TargetFont);
    _stprintf(Buffer,TEXT("MapSpaceMode=%d"),MapSpaceMode);
    TextInBox(Surface, &rc, Buffer, (rc.right+rc.left)/2, NIBLSCALE(50) , &TextDisplayMode, false);
    break;
  }
#ifdef DRAWLKSTATUS
  // no need to clear dodrawlkstatus, it is already reset at each run
  if (dodrawlkstatus) DrawLKStatus(hdc, rc);
#endif
  Surface.SelectObject(oldfont);
}