Ver 1.10
表示する文字列の色を取得します。
書式
unsigned long GetForegroundColor();
|
パラメータ
戻り値
表示している文字列の色を取得します。
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.SetForegroundColor(CP_RGB(255,128,64));
//選択時の表示文字列の色を設定
LBox.SetSelectForegroundColor(CP_RGB(255,255,0));
//リストボックスをCPWindowに結びつける
win.Add(&LBox);
//表示文字列の色を取得
col=LBox.GetForegroundColor();
rr=CP_RGB_RED(col);
gg=CP_RGB_GREEN(col);
bb=CP_RGB_BLUE(col);
//選択時の表示文字列の色を取得
col=LBox.GetSelectForegroundColor();
s_rr=CP_RGB_RED(col);
s_gg=CP_RGB_GREEN(col);
s_bb=CP_RGB_BLUE(col);
この例では、「rr=255 / gg=128 / bb=64」「s_rr=255 / s_gg=255 / s_bb=0」が入ります。
ビルド時に必要なファイル
ライブラリ
| :CPartsLib.lib (Macintoshの場合は、CPartsCW.a)
|
ヘッダ
| :CPListBox.h
|
関連リンク
CPListBoxクラス
CPListBox::GetBackgroundColor
CPListBox::SetForegroundColor
CPListBox::SetBackgroundColor
CPListBox::GetSelectBackgroundColor
CPListBox::SetSelectBackgroundColor
CPListBox::GetSelectForegroundColor
CPListBox::SetSelectForegroundColor