原程序
CRect rect;
((CComboBox *)(GetDlgItem(IDC_COMBO1)))->GetWindowRect(&rect);rt.bottom+=100;
((CComboBox *)(GetDlgItem(IDC_COMBO1)))->MoveWindow(rect);
我的原意是想让CComboBox拉长100(bottom值增加100, 以显示列表),执行上面二句后CComboBox确定是更高了,但问题是整个ccombobox向右下方移动了,我该怎么做才能保证ccombobox的位置不变呢?谢谢!
CRect rect;
((CComboBox *)(GetDlgItem(IDC_COMBO1)))->GetWindowRect(&rect);rt.bottom+=100;
((CComboBox *)(GetDlgItem(IDC_COMBO1)))->MoveWindow(rect);
我的原意是想让CComboBox拉长100(bottom值增加100, 以显示列表),执行上面二句后CComboBox确定是更高了,但问题是整个ccombobox向右下方移动了,我该怎么做才能保证ccombobox的位置不变呢?谢谢!
解决方案 »
- 使用旧CvvImage的功能opencv3.4.3对应是哪个类?????
- 说想给程序写个简单的注册功能,求教经验
- MFC 对话框 分割 拖拉
- 关于函数指针
- 急、急,怎样在CView类中访问在MainFrame类中创建的对话框中的变量。
- msc/C++ 7.0 的Run怎么不能用啊?Debug、compiler也都不行?
- 想写一个通讯录程序,对文件操作的这部分,有什么方法可以方便查询删除等操作.
- 求教有关拚音和汉字变换问题
- _DEBUG 和 DEBUG 的区别是什么?
- 谁知道大富翁论坛的地址?HELP!!!!!!!!
- 单文档,在CListView的OnInitialUpdate中插入ITEM 不显示?
- 树形控件 多子项插入
ScreenToClient(rect);
rt.bottom+=100;
那个是可以改变 CComboBox::SetItemHeight(-1, XXXX);
int nIndex,
UINT cyItemHeight
);
Parameters
nIndex
Specifies whether the height of list items or the height of the edit-control (or static-text) portion of the combo box is set. If the combo box has the CBS_OWNERDRAWVARIABLE style, nIndex specifies the zero-based index of the list item whose height is to be set; otherwise, nIndex must be 0 and the height of all list items will be set. If nIndex is –1, the height of the edit-control or static-text portion of the combo box is to be set.
cyItemHeight
Specifies the height, in pixels, of the combo-box component identified by nIndex.
这句代码是获得相对于桌面的你的窗口的位置,当然会不对
GetWindowRect(&rect);
this->GetParent()->ScreentoClient(&rect);
这样就可以获得你的窗口在父窗口的位置了