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();
}
必要条件
ヘッダー: afxwin.h