如何在属性页上增加一个与“确定”和“取消”同一行的按钮。
解决方案 »
- 列表框中选中某一行?
- 面试完后,心寒了
- 关于UNICODE与ANSI的转换
- 请问,如果订阅网页上元素的事件?比如一个输入框的输入事情, 按钮的点击事件?
- 为什么我这个小程序总是读不到“回车”呢?请大家帮我看看,谢谢大家了。
- 求托盘编程程序的例子
- 如何拦截窗口的最大化,最小化和关闭这些消息,以便加入自己的处理代码。
- 请问如何制作类似与LeapFTP的界面?????
- 庆元旦,迎新春,新一年,新气向,在这给大家拜个早年,同时也祝CSDN办的越来越好...
- VC++下,在Dialog中如何加入menu ?
- 谁用过硬件防火墙?该怎么接线?
- listbox使用的问题,其中的内容随着滑动条的移动被刷新,但是有重影出现??????
在CMyPropertySheet的OnInitDialog中增加按钮:// 得到“确定”按钮的位置
CWnd *pWndOK = GetDlgItem(IDOK);
CRect rcOK;
pWndOK->GetWindowRect(&rcOK);CRect rcButton(rcOK);
rcButton.Offset(-rcButton.Width(), 0);
m_cButton.Create(...,rcButton,...); // 在目标位置创建一个按钮
{
//...
private:
CButton m_Button;
//...
}2、在指定位置创建按钮
BOOL CYourPropertySheet::OnInitDialog()
{
//...
int ids [] = {IDOK, IDCANCEL};CRect rect0,rect1;
GetDlgItem(ids[0])->GetWindowRect(rect0);
GetDlgItem(ids[1])->GetWindowRect(rect1);ScreenToClient (rect0);
ScreenToClient (rect1);CPoint cpOffset(rect1.left - rect0.left,0);
rect0 -= cpOffset;
m_Button.Create("&MyButton",
WS_CHILD | WS_VISIBLE | WS_TABSTOP,
rect0,
this, 0x8888); //...
}
MyPropSheet.h中:public:
CEdit m_edit;MyPropSheet.cpp中:BOOL CMyPropSheet::OnInitDialog ()
{
BOOL bResult = CPropertySheet::OnInitDialog ();
CRect rect;
int nHeight = 24;
int nWidth = 120;
int nOffset = 6;
GetClientRect (&rect); // Find a bottom-left point for the edit control in the client area
int nX = rect.left + nOffset;
int nY = rect.top + (rect.Height() - nHeight) - nOffset;
// finally create the edit control
m_Edit.CreateEx (WS_EX_CLIENTEDGE, _T("EDIT"), NULL,
WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER,
nX, nY, nWidth, nHeight, m_hWnd, 0, 0 ); return bResult;
}