设置和检索设备上下文画笔颜色值

以下示例演示应用程序如何使用 SetDCBrushColorGetDCBrushColor 函数检索当前 DC 画笔颜色。

SelectObject(hdc,GetStockObject(DC_BRUSH));
SetDCBrushColor(hdc,RGB(00,0xff,00));
PatBlt(hdc,0,0,200,200,PATCOPY);
SetDCBrushColor(hdc,RGB(00,00,0xff));
PatBlt(hdc,0,0,200,200,PATCOPY);