目次に戻る
一覧ページに戻る
CPListBox::GetBackgroundColor
2002/09/29 update.
Ver 1.10
背景色を取得します。

書式

  unsigned long GetBackgroundColor();

パラメータ


戻り値
リストボックスの背景色を取得します。
CP_RGBと同じ形式で格納されています。

解説


リストボックスの背景色を取得します。
各RGB成分に分解する場合は、「CP_RGB_RED / CP_RGB_GREEN / CP_RGB_BLUE」マクロを使用してください。





ウィンドウ(ダイアログ)を生成して、その中にリストボックスを配置します。

CPWindow win;
CPListBox LBox;
unsigned long col;
int rr,gg,bb;
int s_rr,s_gg,s_bb;

//ダイアログを生成する
win.Clear();
win.CreateNewDialog("TestDialog",120,120,300,200);

//リストボックスの位置・サイズを指定
LBox.SetBounds(10,10,120,80);

//リストボックスに文字列を追加
LBox.AddText("Item 1");
LBox.AddText("Item 2");
LBox.AddText("Item 3");

//リストボックスの背景色を設定
LBox.SetBackgroundColor(CP_RGB(32,64,128));

//リストボックスの選択時の背景色を設定
LBox.SetSelectBackgroundColor(CP_RGB(32,32,96));

//リストボックスをCPWindowに結びつける
win.Add(&LBox);

//背景色を取得
col=LBox.GetBackgroundColor();
rr=CP_RGB_RED(col);
gg=CP_RGB_GREEN(col);
bb=CP_RGB_BLUE(col);

//選択時の背景色を取得
col=LBox.GetSelectBackgroundColor();
s_rr=CP_RGB_RED(col);
s_gg=CP_RGB_GREEN(col);
s_bb=CP_RGB_BLUE(col);

この例では、「rr=32 / gg=64 / bb=128」「s_rr=32 / s_gg=32 / s_bb=96」が入ります。


ビルド時に必要なファイル


ライブラリ :CPartsLib.lib (Macintoshの場合は、CPartsCW.a)
ヘッダ :CPListBox.h


関連リンク


CPListBoxクラス
CPListBox::GetForegroundColor
CPListBox::SetForegroundColor
CPListBox::SetBackgroundColor
CPListBox::GetSelectForegroundColor
CPListBox::SetSelectForegroundColor
CPListBox::GetSelectBackgroundColor
CPListBox::SetSelectBackgroundColor