使用GDI+绘制圆环,抗锯齿 (vc)

void CRoundWnd::OnPaint(Gdiplus::Graphics* dc)
{
	dc->SetSmoothingMode(Gdiplus::SmoothingModeHighQuality);//抗锯齿 
	//外圆
	Gdiplus::Pen pen(Gdiplus::Color(255, GetRValue(m_crOuterClr), GetGValue(m_crOuterClr), GetBValue(m_crOuterClr)));
	dc->DrawEllipse(&pen, m_rcWindow.left, m_rcWindow.top, m_rcWindow.Width(), m_rcWindow.Height());

 	Gdiplus::SolidBrush brush(Gdiplus::Color(255, GetRValue(m_crOuterClr), GetGValue(m_crOuterClr), GetBValue(m_crOuterClr)));
 	dc->FillEllipse(&brush, m_rcWindow.left, m_rcWindow.top, m_rcWindow.Width(), m_rcWindow.Height());
 
 	//内圆
 	Gdiplus::SolidBrush brush2(Gdiplus::Color(255, GetRValue(m_crInnerClr), GetGValue(m_crInnerClr), GetBValue(m_crInnerClr)));
 	dc->FillEllipse(&brush2, 
 		m_rcWindow.left+m_sizeInnerPos.cx, 
 		m_rcWindow.top+m_sizeInnerPos.cy, 
 		m_rcWindow.Width() - m_sizeInnerPos.cx*2, 
 		m_rcWindow.Height() - m_sizeInnerPos.cy*2);

}
COLORREF m_crOuterClr;
COLORREF m_crInnerClr;
CSize m_sizeInnerPos;


你可能感兴趣的:(抗锯齿,gdiplus,FillEllipse,DrawEllipse,圆环)