Compartilhar via


CBrush::CreateBrushIndirect

Inicializa um pincel com um estilo, uma cor, e um padrão especificado em uma estrutura de LOGBRUSH .

BOOL CreateBrushIndirect( 
   const LOGBRUSH* lpLogBrush  
);

Parâmetros

  • lpLogBrush
    Pontos a estrutura de LOGBRUSH que contém informações sobre o pincel.

Valor de retorno

Diferente de zero se a função é com êxito; se não 0.

Comentários

O pincel posteriormente pode ser marcada como o pincel atual para qualquer contexto de dispositivo.

Um pincel criada usando plano (1, 1) bit por pixel um bitmap monocromático é desenhada usando o texto e as cores de plano de fundo atual. Os pixels representados por um bit definido como 0 serão desenhados com a cor do texto atual. Os pixels representados por um bit definido como 1 serão desenhados com a cor do plano de fundo atual.

Exemplo

// Initialize a LOGBRUSH structure.
LOGBRUSH logBrush;
logBrush.lbStyle = BS_HATCHED;
logBrush.lbColor = RGB(0, 192, 192);
logBrush.lbHatch = HS_CROSS;

// Declare an uninitialized CBrush ...
CBrush brush;
// ... and initialize it with the LOGBRUSH.
brush.CreateBrushIndirect(&logBrush);

// Select the brush (and perhaps a pen) into 
// the device context.
CBrush* pOldBrush = (CBrush*)pDC->SelectObject(&brush);
CPen* pOldPen = (CPen*)pDC->SelectStockObject(BLACK_PEN);

// Have fun!
pDC->Pie(CRect(100, 100, 300, 300), CPoint(0, 0), CPoint(50, 200));

// Restore the original device context objects.
pDC->SelectObject(pOldBrush);
pDC->SelectObject(pOldPen);

Requisitos

Cabeçalho: afxwin.h

Consulte também

Referência

Classe CBrush

Gráfico da hierarquia

CBrush::CreateDIBPatternBrush

CBrush::CreatePatternBrush

CBrush::CreateSolidBrush

CBrush::CreateHatchBrush

CGdiObject::CreateStockObject

CGdiObject::DeleteObject

CreateBrushIndirect