首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

小弟我在客户区中画了一个圆,怎么把其中1/3的扇形区域填充为黄色,小弟我想监控磁盘驱动器状态

2012-03-05 
我在客户区中画了一个圆,如何把其中1/3的扇形区域填充为黄色,我想监控磁盘驱动器状态CDC*pDCGetDC()....

我在客户区中画了一个圆,如何把其中1/3的扇形区域填充为黄色,我想监控磁盘驱动器状态
CDC   *pDC=GetDC();
......下面的怎么写????

[解决办法]
以下画了一个90度的饼图
CRect rectClient;
GetClientRect(rectClient);

// Make a couple of pens and similar brushes.
CPen penBlue, penRed;
CBrush brushBlue, brushRed;
CBrush* pOldBrush;
CPen* pOldPen;

brushBlue.CreateSolidBrush(RGB(0, 0, 255));
brushRed.CreateHatchBrush(HS_FDIAGONAL, RGB(255, 0, 0));
penBlue.CreatePen(PS_SOLID | PS_COSMETIC, 1, RGB(0, 0, 255));
penRed.CreatePen(PS_SOLID | PS_COSMETIC, 1, RGB(255, 0, 0));

// Draw from 3 o 'clock to 6 o 'clock, counterclockwise,
// in a blue pen with a solid blue fill.

pOldPen = pDC-> SelectObject(&penBlue);
pOldBrush = pDC-> SelectObject(&brushBlue);

pDC-> Pie(rectClient,
CPoint(rectClient.right, rectClient.CenterPoint().y),
CPoint(rectClient.CenterPoint().x, rectClient.right));

// Draw the remaining quarter slice from 6 o 'clock
// to 3 o 'clock, counterclockwise, in a red pen with
// the hatched brush.
pDC-> SelectObject(&penRed);
pDC-> SelectObject(&brushRed);

// Same parameters, but reverse start and end points.
pDC-> Pie(rectClient,
CPoint(rectClient.CenterPoint().x, rectClient.right),
CPoint(rectClient.right, rectClient.CenterPoint().y));

// Restore the previous pen.
pDC-> SelectObject(pOldPen);

热点排行