How to create a resizeable dialog box with scroll bars in Visual C++
2010-05-26 13:17
786 查看
How to create a resizeable dialog box with scroll bars in Visual C++
http://support.microsoft.com/kb/262954/en-us/ http://msdn.microsoft.com/en-us/library/bb787531%28v=VS.85%29.aspx#wm_paint
GetClientRect(m_rect);
if(m_rect.bottom<rect.bottom)
{
m_rect.bottom = rect.bottom-m_rect.Height();
SetScrollRange(SB_VERT,0,m_rect.bottom);
ShowScrollBar(SB_VERT, TRUE);
}
void CUsageDisplayTab::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default
// TODO: Add your message handler code here and/or call default
int nDelta;
int nMaxPos = m_rect.Height() /*- m_nCurHeight*/;
switch (nSBCode)
{
case SB_LINEDOWN:
if (m_nScrollPos >= nMaxPos)
return;
nDelta = min(nMaxPos/100,nMaxPos-m_nScrollPos);
break;
case SB_LINEUP:
if (m_nScrollPos <= 0)
return;
nDelta = -min(nMaxPos/100,m_nScrollPos);
break;
case SB_PAGEDOWN:
if (m_nScrollPos >= nMaxPos)
return;
nDelta = min(nMaxPos/10,nMaxPos-m_nScrollPos);
break;
case SB_THUMBPOSITION:
nDelta = (int)nPos - m_nScrollPos;
break;
case SB_PAGEUP:
if (m_nScrollPos <= 0)
return;
nDelta = -min(nMaxPos/10,m_nScrollPos);
break;
default:
return;
}
m_nScrollPos += nDelta;
SetScrollPos(SB_VERT,m_nScrollPos,TRUE);
ScrollWindow(0,-nDelta);
CTabPageSSL::OnVScroll(nSBCode, nPos, pScrollBar);
}
dynamic created button
m_cChkbx[i] = new CButton;
m_cChkbx[i]->Create("",WS_CHILD ,rect ,this, GET_CHEKBOX_ID(i));
m_cChkbx[i]->SetFont(pChkFont);
m_cChkbx[i]->SetButtonStyle(BS_AUTOCHECKBOX);
m_cChkbx[i]->ShowWindow(SW_SHOW);
http://support.microsoft.com/kb/262954/en-us/ http://msdn.microsoft.com/en-us/library/bb787531%28v=VS.85%29.aspx#wm_paint
GetClientRect(m_rect);
if(m_rect.bottom<rect.bottom)
{
m_rect.bottom = rect.bottom-m_rect.Height();
SetScrollRange(SB_VERT,0,m_rect.bottom);
ShowScrollBar(SB_VERT, TRUE);
}
void CUsageDisplayTab::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default
// TODO: Add your message handler code here and/or call default
int nDelta;
int nMaxPos = m_rect.Height() /*- m_nCurHeight*/;
switch (nSBCode)
{
case SB_LINEDOWN:
if (m_nScrollPos >= nMaxPos)
return;
nDelta = min(nMaxPos/100,nMaxPos-m_nScrollPos);
break;
case SB_LINEUP:
if (m_nScrollPos <= 0)
return;
nDelta = -min(nMaxPos/100,m_nScrollPos);
break;
case SB_PAGEDOWN:
if (m_nScrollPos >= nMaxPos)
return;
nDelta = min(nMaxPos/10,nMaxPos-m_nScrollPos);
break;
case SB_THUMBPOSITION:
nDelta = (int)nPos - m_nScrollPos;
break;
case SB_PAGEUP:
if (m_nScrollPos <= 0)
return;
nDelta = -min(nMaxPos/10,m_nScrollPos);
break;
default:
return;
}
m_nScrollPos += nDelta;
SetScrollPos(SB_VERT,m_nScrollPos,TRUE);
ScrollWindow(0,-nDelta);
CTabPageSSL::OnVScroll(nSBCode, nPos, pScrollBar);
}
dynamic created button
m_cChkbx[i] = new CButton;
m_cChkbx[i]->Create("",WS_CHILD ,rect ,this, GET_CHEKBOX_ID(i));
m_cChkbx[i]->SetFont(pChkFont);
m_cChkbx[i]->SetButtonStyle(BS_AUTOCHECKBOX);
m_cChkbx[i]->ShowWindow(SW_SHOW);
相关文章推荐
- How can I use Microsoft Visual C++ 2010 to create MEX files with MATLAB 7.10 (R2010a)?
- How to create a project with existing folder of files in Visual Studio?
- How to debug c++ console application with argument in visual studio 2012
- How can I use Microsoft Visual C++ 2010 to create MEX files with MATLAB 7.10 (R2010a)?
- How to create MFC applications that do not have a menu bar in Visual C++(MFC单文档和多文档程序中去掉菜单栏)(转)
- Using Dialog Templates to create an InputBox() in C++
- How to create custom shortcut in visual studio
- How to implement popup Calendar dialog box with DataGrid
- How to create custom navigation menu in SharePoint with XML data source 使用XML数据源在SharePoint创建自定义导航菜单
- How to Create QuickAction Dialog in Android
- how to open property manager in Visual C++ 2010 express edition
- How to make our assemblies appeared in Add Reference dialog box
- How to create your own api with ACL in Magento
- How to Resolve the 'Error MSB6006 tsc.exe exited with code 2' build error in Visual Studio 2015
- How to install OS X Mavericks in Virtualbox with Niresh
- How to create a PictureMarkerSymbol (Picture Symbol)in ArcGIS server with C#
- How To Use ADO.NET to Retrieve and Modify Records in an Excel Workbook With Visual Basic .NET(利用Ado.net导出到Excel)
- How to Compile XviD with Microsoft Visual C++ 6.0(zhuan)
- How to play '.rm' files with RhythmBox in Ubutu?
- how to create a window ot dialog with fixed size?