////////////////////////////////////////////////////////////////////

//OnInitDialog에서

 CRect rt;

 m_BigImage.Create( IDB_SMALL, 32, 1, RGB(255,255,255) );


 m_ctrList.SetImageList( &m_BigImage, LVSIL_NORMAL );
 m_ctrList.SetImageList( &m_imageTree, LVSIL_SMALL );

 

 m_ctrList.GetClientRect( &rt );


 m_ctrList.InsertColumn(0, "캐릭터 이름", LVCFMT_CENTER, 100 );
 m_ctrList.InsertColumn(1, "타입", LVCFMT_CENTER, 50 );
 m_ctrList.InsertColumn(2, "HP", LVCFMT_CENTER, 50 );
 m_ctrList.InsertColumn(3, "MP", LVCFMT_CENTER, rt.Width() - 120 );
 
 //아이템 초기화
 CString str;
 
 m_ctrList.InsertItem( 0, "루시안칼츠", 0 );
 m_ctrList.SetItemText( 0, 1, "전사" );
 m_ctrList.SetItemText( 0, 2, "1000" );
 m_ctrList.SetItemText( 0, 3, "200" );

 

 m_ctrList.InsertItem( 1, "이스핀샤를", 1 );
 m_ctrList.SetItemText( 1, 1, "마법사" );
 m_ctrList.SetItemText( 1, 2, "500" );
 m_ctrList.SetItemText( 1, 3, "1000" );

 

 m_ctrList.InsertItem( 2, "나야트레이", 2 );
 m_ctrList.SetItemText( 2, 1, "엘프" );
 m_ctrList.SetItemText( 2, 2, "600" );
 m_ctrList.SetItemText( 2, 3, "500" );

 

 m_ctrList.InsertItem( 3, "보리스진네만", 3 );
 m_ctrList.SetItemText( 3, 1, "다크엘크" );
 m_ctrList.SetItemText( 3, 2, "700" );
 m_ctrList.SetItemText( 3, 3, "300" );
 
 //리스트 컨트롤의 다양한 스타일 지원
 m_ctrList.SetExtendedStyle( LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES );
 m_ctrList.ModifyStyle( LVS_TYPEMASK, LVS_REPORT );

/////////////////////////////////////////////////////////////////////////////////////////

 

/////////////////////////////////////////////////////////////////////////////////////////

//OnClickList에서

POSITION pos;
CString str;

 

pos = m_ctrList.GetFirstSelectedItemPosition();

str = m_ctrList.GetItemText( m_ctrList.GetNextSelectedItem(pos), 0 );

 

SetDlgItemText( IDC_EDIT_LIST, str );

////////////////////////////////////////////////////////////////////////////////////////

+ Recent posts