本文整理汇总了C++中ListView_SetImageList函数的典型用法代码示例。如果您正苦于以下问题:C++ ListView_SetImageList函数的具体用法?C++ ListView_SetImageList怎么用?C++ ListView_SetImageList使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ListView_SetImageList函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ListView_SetImageList
void CTDCTaskListCtrl::SetTasksImageList(HIMAGELIST hil, BOOL bState, BOOL bOn)
{
if (bOn)
ListView_SetImageList(m_lcTasks, hil, (bState ? LVSIL_STATE : LVSIL_SMALL));
else
ListView_SetImageList(m_lcTasks, NULL, (bState ? LVSIL_STATE : LVSIL_SMALL));
}
示例2: initListViewImageLists
BOOL initListViewImageLists()
{
HIMAGELIST hILSmall; // handle cua image list small
HIMAGELIST hILLarge; // handle cua image list large
// Tao lap cac Image list.
hILSmall = ImageList_Create(CX_ICON_SMALL, CY_ICON_SMALL, ILC_COLOR32 | ILC_MASK, NUM_ICONS, 1000);
hILLarge = ImageList_Create(CX_ICON_LARGE, CY_ICON_LARGE, ILC_COLOR32 | ILC_MASK, NUM_ICONS, 1000);
// Add cac incon vao Image List
// for(int idx = IDI_ICON1; idx < IDI_ICON1 + NUM_ICONS; idx++)
// {
// HICON hIcon = LoadIcon(HInstance, MAKEINTRESOURCE(idx));
//
// ImageList_AddIcon(hILSmall, hIcon);
// ImageList_AddIcon(hILLarge, hIcon);
// }
// Kiem tra so icon co trong Image list
// if(ImageList_GetImageCount(hILSmall) < NUM_ICONS || ImageList_GetImageCount(hILLarge) < NUM_ICONS)
// return FALSE;
// Gan Image lists cho List View
ListView_SetImageList(hwndListView, hILSmall, LVSIL_SMALL);
ListView_SetImageList(hwndListView, hILLarge, LVSIL_NORMAL);
return TRUE;
}
示例3: InitCommonControls
BOOL ZipDlg::OnInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam)
{
InitCommonControls();
// 変数初期化
hInstance = (HINSTANCE)GetWindowLong( hDlg, GWL_HINSTANCE) ;
// アイコン設定
HICON hIcon = LoadIcon( hInstance, MAKEINTRESOURCE( IDI_ICON));
SendMessage( hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
SendMessage( hDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
DestroyIcon( hIcon) ;
// ウインドウハンドル取得
hwndList = GetDlgItem( hDlg, IDC_LIST) ;
hwndOk = GetDlgItem( hDlg, IDOK) ;
hwndDel = GetDlgItem( hDlg, IDC_DEL) ;
// リスト設定
SetWindowLong( hwndList, GWL_STYLE, GetWindowLong( hwndList, GWL_STYLE) | LVS_SHAREIMAGELISTS) ;
DragAcceptFiles( hwndList, TRUE) ;
ListView_DeleteAllItems( hwndList) ;
LVCOLUMN lvclm ;
lvclm.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM ;
lvclm.fmt = LVCFMT_LEFT ;
lvclm.pszText = "ファイル名" ;
lvclm.cx = 150 ;
lvclm.iSubItem = 0 ;
ListView_InsertColumn( hwndList, 0, &lvclm);
lvclm.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM ;
lvclm.fmt = LVCFMT_LEFT ;
lvclm.pszText = "パス" ;
lvclm.cx = 250 ;
lvclm.iSubItem = 0 ;
ListView_InsertColumn( hwndList, 1, &lvclm);
SHFILEINFO shfi ;
HIMAGELIST hImageList = (HIMAGELIST)SHGetFileInfo( "", 0, &shfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON) ;
ListView_SetImageList( hwndList, hImageList, LVSIL_SMALL) ;
hImageList = (HIMAGELIST)SHGetFileInfo( "", 0, &shfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_LARGEICON) ;
ListView_SetImageList( hwndList, hImageList, LVSIL_NORMAL) ;
// 初期化
EnableWindow( hwndDel, FALSE) ;
EnableWindow( hwndOk, FALSE) ;
if( Profile::blnOnlyMp3)CheckDlgButton( hDlg, IDC_ONLYMP3, BST_CHECKED) ;
RECT rc ;
GetWindowRect( hDlg, &rc) ;
MoveWindow( hDlg, Profile::intX, Profile::intY, rc.right, rc.bottom, FALSE) ;
wpcList = (WNDPROC)GetWindowLong( hwndList, GWL_WNDPROC) ;
if( wpcList)
{
SetWindowLong( hwndList, GWL_WNDPROC , (LONG)ListProc) ;
SetWindowLong( hwndList, GWL_USERDATA, (LONG)this) ;
}
return TRUE ;
}
示例4: insert_image_lists
//----------------------------------------------------------------------------------------------------------------------
// INSERT IMAGE LISTS
//----------------------------------------------------------------------------------------------------------------------
void cListViewComputers :: insert_image_lists ( HWND hwnd )
{
HANDLE hStateBlue = 0;
HANDLE hStateGold = 0;
HANDLE hStateGray = 0;
//-----------------------------------
// INSERT IMAGES IN ORDER
// 0 == GRAY == NO CONNECTIONS
// 1 == GOLD == ONE-WAY CONNECTION
// 2 == BLUE == TWO-WAY CONNECTION
//-----------------------------------
HANDLE hDeskStraightGray = LoadImage ( g_hInstance, MAKEINTRESOURCE ( IDI_COMPUTER_GRAY ),
IMAGE_ICON, 85, 73, LR_CREATEDIBSECTION );
HANDLE hDeskStraightGold = LoadImage ( g_hInstance, MAKEINTRESOURCE ( IDI_COMPUTER_GOLD), // returns 0 on fail
IMAGE_ICON, 85, 73, LR_CREATEDIBSECTION | LR_LOADTRANSPARENT );
HANDLE hDeskStraightBlue = LoadImage ( g_hInstance, MAKEINTRESOURCE ( IDI_COMPUTER_BLUE ),
IMAGE_ICON, 85, 73, LR_CREATEDIBSECTION );
hStateGray = LoadImage ( g_hInstance, MAKEINTRESOURCE ( IDI_CONNECTION_STATE_GRAY ),
IMAGE_ICON, 16,24, LR_CREATEDIBSECTION );
hStateGold = LoadImage ( g_hInstance, MAKEINTRESOURCE ( IDI_CONNECTION_STATE_GOLD ),
IMAGE_ICON, 16,24, LR_CREATEDIBSECTION );
hStateBlue = LoadImage ( g_hInstance, MAKEINTRESOURCE ( IDI_CONNECTION_STATE_BLUE ),
IMAGE_ICON, 16,24, LR_CREATEDIBSECTION );
hImageListLarge = ImageList_Create ( 85, 73, ILC_MASK | ILC_COLORDDB | ILC_COLOR32, 3, 0 );
HRESULT iResult = ImageList_AddIcon ( hImageListLarge, (HICON)hDeskStraightGray );
iResult = ImageList_AddIcon ( hImageListLarge, (HICON)hDeskStraightGold );
iResult = ImageList_AddIcon ( hImageListLarge, (HICON)hDeskStraightBlue );
hImageListState = ImageList_Create ( 16, 24, ILC_MASK | ILC_COLORDDB | ILC_COLOR32, 3, 0 );
iResult = ImageList_AddIcon ( hImageListState, (HICON)hStateGray);
iResult = ImageList_AddIcon ( hImageListState, (HICON)hStateGold );
iResult = ImageList_AddIcon ( hImageListState, (HICON)hStateBlue );
HIMAGELIST hResult = ListView_SetImageList ( hwnd, hImageListLarge, LVSIL_NORMAL );
ListView_SetExtendedListViewStyle ( hwnd, LVS_EX_BORDERSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP );
hResult = ListView_SetImageList ( hwnd, hImageListState, LVSIL_STATE );
HWND hHeader = ListView_GetHeader ( hwnd );
RECT rect;
GetWindowRect ( hHeader, & rect );
MoveWindow ( hHeader, rect.left, rect.top, 200, 100, TRUE );
ShowWindow ( hHeader, SW_NORMAL );
}
示例5: DirList_Init
//=============================================================================
//
// DirList_Init()
//
// Initializes the DLDATA structure and sets up the listview control
//
BOOL DirList_Init(HWND hwnd,LPCWSTR pszHeader)
{
HIMAGELIST hil;
SHFILEINFO shfi;
LV_COLUMN lvc;
// Allocate DirListData Property
LPDLDATA lpdl = (LPVOID)GlobalAlloc(GPTR,sizeof(DLDATA));
SetProp(hwnd,pDirListProp,(HANDLE)lpdl);
// Setup dl
lpdl->hwnd = hwnd;
lpdl->cbidl = 0;
lpdl->pidl = NULL;
lpdl->lpsf = NULL;
lstrcpy(lpdl->szPath,L"");
// Add Imagelists
hil = (HIMAGELIST)SHGetFileInfo(L"C:\\",0,&shfi,sizeof(SHFILEINFO),
SHGFI_SMALLICON | SHGFI_SYSICONINDEX);
ListView_SetImageList(hwnd,hil,LVSIL_SMALL);
hil = (HIMAGELIST)SHGetFileInfo(L"C:\\",0,&shfi,sizeof(SHFILEINFO),
SHGFI_LARGEICON | SHGFI_SYSICONINDEX);
ListView_SetImageList(hwnd,hil,LVSIL_NORMAL);
// Initialize default icons - done in DirList_Fill()
//SHGetFileInfo(L"Icon",FILE_ATTRIBUTE_DIRECTORY,&shfi,sizeof(SHFILEINFO),
// SHGFI_USEFILEATTRIBUTES | SHGFI_SMALLICON | SHGFI_SYSICONINDEX);
//lpdl->iDefIconFolder = shfi.iIcon;
//SHGetFileInfo(L"Icon",FILE_ATTRIBUTE_NORMAL,&shfi,sizeof(SHFILEINFO),
// SHGFI_USEFILEATTRIBUTES | SHGFI_SMALLICON | SHGFI_SYSICONINDEX);
//lpdl->iDefIconFile = shfi.iIcon;
lpdl->iDefIconFolder = 0;
lpdl->iDefIconFile = 0;
// Icon thread control
lpdl->hExitThread = CreateEvent(NULL,TRUE,FALSE,NULL);
lpdl->hTerminatedThread = CreateEvent(NULL,TRUE,TRUE,NULL);
lvc;
pszHeader;
return TRUE;
}
示例6: InitListViewImageLists
BOOL InitListViewImageLists(HWND hWndListView)
{
HICON hiconItem; // Icon for list-view items.
HIMAGELIST hLarge; // Image list for icon view.
HIMAGELIST hSmall; // Image list for other views.
// Create the full-sized icon image lists.
hLarge = ImageList_Create(25,
25,
ILC_COLORDDB | ILC_MASK, 2, 1);
hSmall = ImageList_Create(25,
25,
ILC_COLORDDB | ILC_MASK, 2, 1);
// Add an icon to each image list.
//hiconItem = LoadIcon(g_hInstance, TEXT("haha1"));
ImageList_AddIcon(hLarge, hiconItem);
ImageList_AddIcon(hSmall, hiconItem);
DestroyIcon(hiconItem);
//hiconItem = LoadIcon(g_hInstance, TEXT("haha2"));
ImageList_AddIcon(hLarge, hiconItem);
ImageList_AddIcon(hSmall, hiconItem);
DestroyIcon(hiconItem);
// When you are dealing with multiple icons, you can use the previous four lines of
// code inside a loop. The following code shows such a loop. The
// icons are defined in the application's header file as resources, which
// are numbered consecutively starting with IDS_FIRSTICON. The number of
// icons is defined in the header file as C_ICONS.
/*
for(index = 0; index < C_ICONS; index++)
{
hIconItem = LoadIcon (g_hinst, MAKEINTRESOURCE(IDS_FIRSTICON + index));
ImageList_AddIcon(hSmall, hIconItem);
ImageList_AddIcon(hLarge, hIconItem);
Destroy(hIconItem);
}
*/
// Assign the image lists to the list-view control.
ListView_SetImageList(hWndListView, hLarge, LVSIL_NORMAL);
ListView_SetImageList(hWndListView, hSmall, LVSIL_SMALL);
return TRUE;
}
示例7: InitListViewColumns
void InitListViewColumns( HWND hListView, const LISTVIEW_COLUMN * Cols, int numColumns, long style )
{
HKEY hKey;
DWORD valLength;
TCHAR colName[32];
RECT rc;
// Get window sizes
rc.left = -1;
rc.top = -1;
RegCreateKey(HKEY_CURRENT_USER, _T("Software\\Sysinternals\\ShareEnum"), &hKey );
valLength = sizeof(DWORD);
RegQueryValueEx( hKey, _T("x"), NULL, NULL, (LPBYTE) &rc.left,
&valLength );
RegQueryValueEx( hKey, _T("y"), NULL, NULL, (LPBYTE) &rc.top,
&valLength );
RegQueryValueEx( hKey, _T("w"), NULL, NULL, (LPBYTE) &rc.right,
&valLength );
RegQueryValueEx( hKey, _T("h"), NULL, NULL, (LPBYTE) &rc.bottom,
&valLength );
if( rc.left != -1 && rc.top != -1 )
MoveWindow( GetParent( hListView), rc.left, rc.top, rc.right, rc.bottom, TRUE );
// Set listview styles
ListView_SetExtendedListViewStyleEx( hListView, style, style );
// Create columns
for ( int i = 0; i < numColumns; ++i ) {
LVCOLUMN col = { 0 };
col.mask = LVCF_TEXT | LVCF_WIDTH;
col.pszText = (TCHAR *)Cols[i].Title;
col.cx = Cols[i].Width;
_stprintf( colName, _T("Column%d"), i );
DWORD val = -1;
valLength = sizeof(DWORD);
RegQueryValueEx( hKey,colName, NULL, NULL, (LPBYTE) &val, &valLength );
if ( val < 600 )
col.cx = val;
ListView_InsertColumn( hListView, i, &col );
}
RegCloseKey( hKey );
HINSTANCE hInstance = GetModuleHandle(NULL);
// Create image list (order corresponds to LISTVIEW_IMG_* enumeration)
HIMAGELIST hImageList = ImageList_Create( GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLORDDB, 10, 30 );
UINT loadFlags = LR_DEFAULTCOLOR | LR_LOADTRANSPARENT | LR_SHARED;
ImageList_SetBkColor( hImageList, GetSysColor(COLOR_WINDOW) );
ImageList_AddIcon( hImageList, (HICON) LoadImage( hInstance, MAKEINTRESOURCE(IDI_FILE), IMAGE_ICON, 16, 16, loadFlags));
ImageList_SetBkColor( hImageList, GetSysColor(COLOR_BTNFACE) );
ImageList_AddIcon( hImageList, (HICON) LoadImage( hInstance, MAKEINTRESOURCE(IDI_DOWNARROW), IMAGE_ICON, 16, 16, loadFlags ) );
ImageList_AddIcon( hImageList, (HICON) LoadImage( hInstance, MAKEINTRESOURCE(IDI_UPARROW), IMAGE_ICON, 16, 16, loadFlags ) );
ImageList_SetBkColor( hImageList, GetSysColor(COLOR_WINDOW) );
ImageList_AddIcon( hImageList, (HICON) LoadImage( hInstance, MAKEINTRESOURCE(IDI_FILEGOOD), IMAGE_ICON, 16, 16, loadFlags ) );
ImageList_AddIcon( hImageList, (HICON) LoadImage( hInstance, MAKEINTRESOURCE(IDI_FILEBAD), IMAGE_ICON, 16, 16, loadFlags ) );
ListView_SetImageList( hListView, hImageList, LVSIL_SMALL );
}
示例8: CreateResultsColumns
void CreateResultsColumns(HWND hwndResults, struct FindAddDlgData *dat, char *szProto)
{
SaveColumnSizes(hwndResults);
while (ListView_DeleteColumn(hwndResults, 0));
ListView_SetImageList(hwndResults, dat->himlComboIcons, LVSIL_SMALL);
LoadColumnSizes(hwndResults, szProto);
}
示例9: ListView_SetImageList
void CLogView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
m_pLogList = &GetListCtrl();
I_LogList.Create(16, 16, ILC_COLOR32|ILC_MASK,10, 0);
HICON hIcon = NULL;//以下为加入3个图标资源
hIcon = (HICON)::LoadImage(::AfxGetInstanceHandle(),MAKEINTRESOURCE(IDI_EVENT_INFO), IMAGE_ICON, 16, 16, 0);
I_LogList.Add(hIcon);
hIcon = (HICON)::LoadImage(::AfxGetInstanceHandle(),MAKEINTRESOURCE(IDI_EVENT_ERROR), IMAGE_ICON, 16, 16, 0);
I_LogList.Add(hIcon);
hIcon = (HICON)::LoadImage(::AfxGetInstanceHandle(),MAKEINTRESOURCE(IDI_BE_CAREFUL), IMAGE_ICON, 16, 16, 0);
I_LogList.Add(hIcon);
ListView_SetImageList(m_pLogList->m_hWnd, I_LogList, LVSIL_SMALL);
m_pLogList->SetExtendedStyle(/*LVIF_PARAM |*/ LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP|/*LVS_EX_FLATSB|*/
LVS_EX_ONECLICKACTIVATE | LVS_EX_UNDERLINEHOT |LVS_EX_SUBITEMIMAGES |LVS_EX_GRIDLINES);
for (int i = 0; i < g_Log_Count; i++)
{
m_pLogList->InsertColumn(i, g_Log_Data[i].title);
m_pLogList->SetColumnWidth(i, g_Log_Data[i].nWidth);
g_Log_Width += g_Log_Data[i].nWidth; // 总宽度
}
HWND hWndHeader = m_pLogList->GetDlgItem(0)->GetSafeHwnd();
m_heades.SubclassWindow(hWndHeader);
m_heades.SetTheme(new CXTHeaderCtrlThemeOffice2003());
// ((CGh0stApp *)AfxGetApp())->m_IniFile.SetString("Other", "Out","1");
}
示例10: InitListViewContorol
void InitListViewContorol(HWND hWnd)
{
HWND hWndLV = GetDlgItem(hWnd, IDC_LIST_MAILBOX);
LV_COLUMN lc;
LV_ITEM li;
HIMAGELIST hImgList;
RECT rect;
GetClientRect(hWndLV, &rect);
// イメージリストの作成
hImgList = ImageList_Create(16, 16, ILC_COLOR | ILC_MASK, 1 , 1);
ImageList_AddIcon(hImgList, LoadIcon(g_hInstance, "IDI_MAILBOX"));
ListView_SetImageList(hWndLV, hImgList, LVSIL_SMALL);
ListView_SetExtendedListViewStyle(hWndLV, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES);
// ヘッダを追加 (表示しない)
lc.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH;
lc.fmt = LVCFMT_LEFT;
lc.pszText = "メールボックス";
lc.cx = rect.right;
lc.iSubItem = 0;
lc.cchTextMax = strlen(lc.pszText);
ListView_InsertColumn(hWndLV, 0, &lc);
lc.pszText = "フォルダ名";
lc.cx = 0;
lc.iSubItem = 1;
lc.cchTextMax = strlen(lc.pszText);
ListView_InsertColumn(hWndLV, 1, &lc);
// メールボックスを列挙
THash MailBoxes;
EnumMailBox(MailBoxes);
// メールボックスを追加
int i = 0;
for (THash::iterator itr = MailBoxes.begin(); itr != MailBoxes.end(); ++itr) {
li.mask = LVIF_TEXT | LVIF_IMAGE;
li.iItem = i;
li.iImage = 0;
// 表示名
li.pszText = (char *)((*itr).second).c_str();
li.iSubItem = 0;
ListView_InsertItem(hWndLV, &li);
// メールボックスのディレクトリ名
li.pszText = (char *)((*itr).first).c_str();
li.iSubItem = 1;
ListView_SetItem(hWndLV, &li);
// 設定されているメールボックスにチェックをつける
if (g_temporary_mailbox.count((*itr).first) == 1) {
ListView_SetCheckState(hWndLV, i, 1);
}
i++;
}
}
示例11: InitListViewImageLists
static BOOL InitListViewImageLists(HWND hwndLV)
{
HIMAGELIST himl; /* handle to image list */
HICON hico; /* handle to icon */
/* Create the image list. */
if ((himl = ImageList_Create(CX_ICON, CY_ICON,
ILC_MASK, 0, NUM_ICONS)) == NULL)
{
return FALSE;
}
hico = LoadIconW(hInst, MAKEINTRESOURCEW(IDI_BIN));
Image_Bin = ImageList_AddIcon(himl, hico);
hico = LoadIconW(hInst, MAKEINTRESOURCEW(IDI_STRING));
Image_String = ImageList_AddIcon(himl, hico);
/* Fail if not all of the images were added. */
if (ImageList_GetImageCount(himl) < NUM_ICONS)
{
return FALSE;
}
/* Associate the image list with the tree view control. */
(void)ListView_SetImageList(hwndLV, himl, LVSIL_SMALL);
return TRUE;
}
示例12: ListView_SetImageList
void InsertObjectDialog::OnDestroy()
{
first_run.Detach();
ListView_SetImageList(objects.m_hWnd, NULL, LVSIL_SMALL);
ListView_SetImageList(objects.m_hWnd, NULL, LVSIL_NORMAL);
if (list_objects.GetCheck() == BST_CHECKED)
g_MainFrame->m_INI.WriteInt("InsertObject", "List", 1);
else
g_MainFrame->m_INI.WriteInt("InsertObject", "List", 0);
CDialog::OnDestroy();
dlgMan.Save();
}
示例13: ListView_SetImageList
BOOL CTDLTaskIconDlg::OnInitDialog()
{
CDialog::OnInitDialog();
ListView_SetImageList(m_lcIcons, m_ilIcons, LVSIL_SMALL);
CPreferences prefs;
for (int nImage = 0; nImage < m_ilIcons.GetImageCount(); nImage++)
{
CString sImage, sKey;
sKey.Format(_T("Icon%d"), nImage + 1);
sImage = prefs.GetProfileString(_T("TaskIcons"), sKey);
if (sImage.IsEmpty())
{
sImage.Format(_T("%d"), nImage + 1);
}
m_lcIcons.InsertItem(nImage, sImage, nImage);
}
if (m_nIconIndex >= 0)
{
m_lcIcons.SetItemState(m_nIconIndex, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
}
// disable OK button if nothing selected
GetDlgItem(IDOK)->EnableWindow(m_nIconIndex >= 0);
m_lcIcons.SetFocus();
return FALSE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例14: initTable
/**
* 初始化列表控件
*/
void initTable(HWND hDlg)
{
HWND table = GetDlgItem(hDlg, IDC_TABLE);
hCourseList = table;
ListView_SetBkColor(table, 0xECF0F1);
ListView_SetExtendedListViewStyle(table, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
HIMAGELIST hImageList = ImageList_Create(1, 100, ILC_COLOR16 | ILC_MASK, 1, 1);
ListView_SetImageList(table, hImageList, LVSIL_STATE);
// 绘制表头
LV_COLUMN column = {LVCF_TEXT | LVCF_WIDTH | LVCF_FMT, LVCFMT_CENTER, 160};
column.pszText = L"时间";
ListView_InsertColumn(table, 1, &column);
CSTR headers = L"一二三四五六天";
Char headerBuffer[] = L"星期*";
for (int i = 0; i < DAY_LENGTH;)
{
headerBuffer[2] = headers[i];
column.pszText = headerBuffer;
ListView_InsertColumn(table, ++i, &column);
}
// 插入行头
LVITEM item = {LVIF_IMAGE | LVIF_TEXT, 0, 0};
while (item.iItem < Course_LENGTH)
{
ListView_InsertItem(table, &item);
item.pszText = (STR)TIME[item.iItem];
ListView_SetItem(table, &item);
++item.iItem;
}
}
示例15: ShellInitDialog
void CPlayListDlg::OnInitDialog(HWND hwndDlg)
{
m_hWnd = hwndDlg;
ShellInitDialog(m_hWnd);
HWND hwndLV = GetDlgItem(m_hWnd, IDC_PLAY_LIST);
RECT rc;
GetClientRect(hwndLV, &rc);
ListView_SetExtendedListViewStyle(hwndLV,
ListView_GetExtendedListViewStyle(hwndLV) | LVS_EX_FULLROWSELECT);
// カラムの挿入
LVCOLUMN lvc;
lvc.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH;
lvc.fmt = LVCFMT_LEFT;
lvc.cx = RECT_WIDTH(&rc) - GetSystemMetrics(SM_CXVSCROLL) - 2;
lvc.pszText = _T("Name");
lvc.iSubItem = 0;
ListView_InsertColumn(hwndLV, 0, &lvc);
// イメージリストを設定
ListView_SetImageList(hwndLV, m_hImageList, LVSIL_SMALL);
// リストを更新
UpdatePlayList();
}