CRect rect;
GetClientRect(rect);
m_ListCtrl.Create(WS_CHILD|WS_VISIBLE|WS_BORDER|LVS_REPORT,rect, this, IDC_LIST);
DWORD dwSystl = ::GetWindowLong(m_ListCtrl.m_hWnd,GWL_STYLE);
SetWindowLong(m_ListCtrl.m_hWnd,GWL_STYLE,dwSystl|LVS_REPORT|WS_CHILD|WS_VISIBLE|WS_BORDER);
DWORD Exsystl =m_ListCtrl.GetExtendedStyle();
m_ListCtrl.SetExtendedStyle(Exsystl|LVS_EX_HEADERDRAGDROP|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_CHECKBOXES);
for (int j = 0; j < g_Column_Count; j++)
{
m_ListCtrl.InsertColumn(j, g_Column_Data[j].title);
m_ListCtrl.SetColumnWidth(j, g_Column_Data[j].nWidth);
g_Column_Width += g_Column_Data[j].nWidth; // 总宽度
}
GetClientRect(rect);
m_ListCtrl.Create(WS_CHILD|WS_VISIBLE|WS_BORDER|LVS_REPORT,rect, this, IDC_LIST);
DWORD dwSystl = ::GetWindowLong(m_ListCtrl.m_hWnd,GWL_STYLE);
SetWindowLong(m_ListCtrl.m_hWnd,GWL_STYLE,dwSystl|LVS_REPORT|WS_CHILD|WS_VISIBLE|WS_BORDER);
DWORD Exsystl =m_ListCtrl.GetExtendedStyle();
m_ListCtrl.SetExtendedStyle(Exsystl|LVS_EX_HEADERDRAGDROP|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_CHECKBOXES);
for (int j = 0; j < g_Column_Count; j++)
{
m_ListCtrl.InsertColumn(j, g_Column_Data[j].title);
m_ListCtrl.SetColumnWidth(j, g_Column_Data[j].nWidth);
g_Column_Width += g_Column_Data[j].nWidth; // 总宽度
}
解决方案 »
- 希望对C++和C#都有较深认识的高手来为我解答疑惑?
- 请问包含 IF EXISTS 的SQL语句可以用 pTheConn->Execute( 执行么?在线等,高手们帮帮忙啊~~~~~~
- OnLButtonDown 为什么不能是虚函数?
- 关于CClientDC的问题
- 用Command Line 编译《深入浅出MFC》中第六章Hello程序失败,请大家帮忙看看
- 请问有没有什么函数能让程序中断,等待指定的时间后在接着短点处运行呢?
- 有谁写过扩展IAS功能的ExtensionDLL吗(100分奉送)
- 求一个MFC写的 简单画图板 的 图文教程
- CheckMenuRadioItem
- 我想CEDITVIEW每落下一个汉字都能取到这个汉字的内容;每落下一行汉字都能取到这行汉字的内容;每落下一段汉字都能取到这段汉字的内容;每落下一页........
- 求教关于线段求交时,叉积的精度容差问题。
- 聊天室
给你一个MSDN上的例子,处理OnHScroll函数,这个例子的各个分支都有,你想干什么,就在分支下做就行.void CMyView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// Get the minimum and maximum scroll-bar positions.
int minpos;
int maxpos;
pScrollBar->GetScrollRange(&minpos, &maxpos);
maxpos = pScrollBar->GetScrollLimit(); // Get the current position of scroll box.
int curpos = pScrollBar->GetScrollPos(); // Determine the new position of scroll box.
switch (nSBCode)
{
case SB_LEFT: // Scroll to far left.
curpos = minpos;
break; case SB_RIGHT: // Scroll to far right.
curpos = maxpos;
break; case SB_ENDSCROLL: // End scroll.
break; case SB_LINELEFT: // Scroll left.
if (curpos > minpos)
curpos--;
break; case SB_LINERIGHT: // Scroll right.
if (curpos < maxpos)
curpos++;
break; case SB_PAGELEFT: // Scroll one page left.
{
// Get the page size.
SCROLLINFO info;
pScrollBar->GetScrollInfo(&info, SIF_ALL);
if (curpos > minpos)
curpos = max(minpos, curpos - (int) info.nPage);
}
break; case SB_PAGERIGHT: // Scroll one page right.
{
// Get the page size.
SCROLLINFO info;
pScrollBar->GetScrollInfo(&info, SIF_ALL); if (curpos < maxpos)
curpos = min(maxpos, curpos + (int) info.nPage);
}
break; case SB_THUMBPOSITION: // Scroll to absolute position. nPos is the position
curpos = nPos; // of the scroll box at the end of the drag operation.
break; case SB_THUMBTRACK: // Drag scroll box to specified position. nPos is the
curpos = nPos; // position that the scroll box has been dragged to.
break;
} // Set the new position of the thumb (scroll box).
pScrollBar->SetScrollPos(curpos); CView::OnHScroll(nSBCode, nPos, pScrollBar);
}