問題如下:



調整list代碼如下:

我希望當list控制元件的大小大于tab的時候,也能出現滾動條。
謝謝
uj5u.com熱心網友回復:
在多增加幾行資料看看,是否有滾動條?uj5u.com熱心網友回復:
加了好幾百條了,不行哦。好神奇!
uj5u.com熱心網友回復:
是不是移動的尺寸超過了顯示區域?rc.right -= 100;
再MoveWindow 試試看
uj5u.com熱心網友回復:
rc.right -= 滾動條寬度uj5u.com熱心網友回復:
滾動條是 在控制元件視窗的右邊,所以 當 控制元件 太寬時就看不見了,所以控制元件寬度要父視窗可見的寬度uj5u.com熱心網友回復:
list 的 視窗 不得 大于 tab 視窗 !uj5u.com熱心網友回復:
老哥,是以最后一條為準嗎,
uj5u.com熱心網友回復:
rc.right -= 滾動條寬度這個不好用uj5u.com熱心網友回復:
void CDlg4::OnSize(UINT nType, int cx, int cy)
{
CBaseDialog::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
if(IsWindow(m_Dlg4Sta4))//
{// when dlg moves.
CRect rcs;
m_Dlg4Sta4.GetWindowRect(&rcs);
static int origW=-1;
static int origH=-1;
if(origW==-1)
{
CRect rct;
m_Tree.GetWindowRect(&rct);
origW=rct.Width();
origH=rct.Height();
}
// You will defer all the application's windows.
HDWP hdwp = BeginDeferWindowPos(2);
// First, Static
DeferWindowPos(hdwp, m_Dlg4Sta4, NULL,
(cx-rcs.Width())/2,0,
rcs.Width(), rcs.Height(),
SWP_NOZORDER);
// Next, CTreeCtrl.
if(cx <= origW)
{
DeferWindowPos(hdwp,m_Tree, NULL,
0,rcs.Height(),// below static !
cx, origH ,//
SWP_NOZORDER);
afxDump << "<=\n";
afxDump << cx << ";" << origW << " w\n";
}
else
{
DeferWindowPos(hdwp,m_Tree, NULL,
(cx-origW)/2,rcs.Height(),// below static !
origW, origH ,
SWP_NOZORDER);
afxDump << ">\n";
}
// redraw all the windows
EndDeferWindowPos(hdwp);
}
}
注意
if(cx <= origW) // 一開始寬度
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/93935.html
標籤:界面
