CBrush::GetLogBrush
调用该成员函数检索 LOGBRUSH 结构。
int GetLogBrush(
LOGBRUSH* pLogBrush
);
参数
- pLogBrush
指向 LOGBRUSH 包含有关画笔的信息的结构。
返回值
如果函数成功,并且,pLogBrush 是有效的指针,则返回值是字节数存储到缓冲区中。
如果函数成功,并且,pLogBrush 是 NULL,则返回值是要求的字节数包含该函数将存储到缓冲区的信息。
如果函数失败,则返回值是0。
备注
LOGBRUSH 结构定义画笔的样式、颜色和模式。
例如,调用 GetLogBrush 与位图的特殊颜色或图案。
示例
// Example for CBrush::GetLogBrush
LOGBRUSH logbrush;
brushExisting.GetLogBrush( &logbrush );
CBrush brushOther( logbrush.lbColor);
// Another example
// Declare a LOGBRUSH
LOGBRUSH logBrush;
// Using a bitmap for this example.
// The bitmap should be a project resource.
CBitmap bm;
bm.LoadBitmap(IDB_BRUSH);
try
{
// Create a brush
CBrush brush1(&bm);
// Use GetLogBrush to fill the LOGBRUSH structure
brush1.GetLogBrush(&logBrush);
// Create a second brush using the LOGBRUSH data
CBrush brush2;
brush2.CreateBrushIndirect(&logBrush);
// Use the first brush
CBrush* pOldBrush = (CBrush*)pDC->SelectObject(&brush1);
pDC->Rectangle(CRect(50,50,150,150));
// The second brush has the specified characteristics
// of the first brush
pDC->SelectObject(&brush2);
pDC->Ellipse(200,50,300,150);
// Reselect the original brush
pDC->SelectObject(pOldBrush);
}
catch(CResourceException* e)
{
e->ReportError();
e->Delete();
}
要求
Header: afxwin.h