次の方法で共有


CBrush::GetLogBrush

更新 : 2007 年 11 月

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

参照

参照

CBrush クラス

階層図

LOGBRUSH

GetObject

その他の技術情報

CBrush のメンバ