程序中的代码,主要看实现思路与步奏
void CxDbgDlg::gotoAddress(DWORD dwAddress) { CString strAddress; strAddress.Format(_T("%08X"), dwAddress); DWORD dwItem = 0; do{ if (g_pListCpu->GetItemText(dwItem, 0) == strAddress){ int nItem = g_pListCpu->GetTopIndex(); // 获取顶层索引 CRect rc; g_pListCpu->GetItemRect(nItem, rc, LVIR_BOUNDS); CSize sz(0, (dwItem - nItem)*rc.Height()); // 取得要滚动的size g_pListCpu->Scroll(sz); // 自滚动 g_pListCpu->SetItemState(dwItem, LVIS_SELECTED, LVIS_SELECTED); // 设置状态为被选中 break; } ++dwItem; } while (TRUE); }
时间: 2024-10-27 13:20:35