如何用GDI+创建实现位图的样式(Hatch),急!
玄山 2003-10-15 05:05:22 用GDI画出一个位图的样式在MSDN中的例子是下面的代码。我想用GDI+实现同样的位图的样式应该怎么实现,但又不想使用GDI+中的HatchBrush来做(原因是不能实现自己定义的图案),找了好久都没在GDI+的函数中能找到设置位图样式的函数,哪位大哥知道这方面的东西,请多多帮助了,先谢谢各位了。
// Create a hatched bit pattern.
WORD HatchBits[8] = { 0x11, 0x22, 0x44, 0x88, 0x11, 0x22, 0x44, 0x88 };
// Use the bit pattern to create a bitmap.
CBitmap bm;
bm.CreateBitmap(8,8,1,1, HatchBits);
// Create a pattern brush from the bitmap.
CBrush brush;
brush.CreatePatternBrush(&bm);
// Select the brush into a device context, and draw.
CBrush* pOldBrush = (CBrush*)pDC->SelectObject(&brush);
pDC->RoundRect(CRect(50, 50, 200, 200), CPoint(10,10));
// Restore the original brush.
pDC->SelectObject(pOldBrush);