在MFC中获取控件相对位置和使按钮变灰
2016-08-17 14:08
525 查看
一.获取控件相对位置。
CRect frameRect;
GetDlgItem(frameId)->GetWindowRect(&frameRect);//获取控件相对于屏幕的位置。
ScreenToClient(frameRect);//转化为对话框上的相对位置。
const int height = frameRect.bottom - frameRect.top;//控件的高
const int width = frameRect.right - frameRect.left;//控件的宽
const int RadioBtnXpos = frameRect.left + BUTTON_HEIGHT;//要新建的控件的横坐标
const int RadioBtnYpos = frameRect.top + BUTTON_HEIGHT;//要新建的控件的纵坐标
二.使对话框中的按钮变灰。
CButton btn;
btn.EnableWindow(FALSE);
或
CWnd *pWnd;
pWnd = GetDlgItem(IDC_BUTTON1);
pWnd->EnableWindow(FALSE);
CRect frameRect;
GetDlgItem(frameId)->GetWindowRect(&frameRect);//获取控件相对于屏幕的位置。
ScreenToClient(frameRect);//转化为对话框上的相对位置。
const int height = frameRect.bottom - frameRect.top;//控件的高
const int width = frameRect.right - frameRect.left;//控件的宽
const int RadioBtnXpos = frameRect.left + BUTTON_HEIGHT;//要新建的控件的横坐标
const int RadioBtnYpos = frameRect.top + BUTTON_HEIGHT;//要新建的控件的纵坐标
二.使对话框中的按钮变灰。
CButton btn;
btn.EnableWindow(FALSE);
或
CWnd *pWnd;
pWnd = GetDlgItem(IDC_BUTTON1);
pWnd->EnableWindow(FALSE);
相关文章推荐
- MFC--获取控件的相对位置
- MFC如何获取控件相对于窗口的左边,以及鼠标相对于控件的位置
- MFC下获取控件相对于子窗口的矩形位置
- MFC 获取picture控件的鼠标点击坐标位置的方法
- WPF如何获取控件之间的相对位置
- mfc控件位置坐标获取
- MFC获取控件位置
- Silverlight 获取控件间的相对位置
- MFC EDIT控件获取焦点位置在字符串的尾部
- ios 获取控件相对屏幕的位置
- WPF中获取控件之间的相对位置
- MFC对话框应用程序 如何在对话框窗口显示前获取窗口(控件)的屏幕坐标位置
- [WPF]获取控件间的相对位置
- [WPF]获取控件间的相对位置
- mfc获取控件在对话框上的位置
- 获取一个控件相对于父窗口的坐标位置
- MFC获取控件位置
- MFC中,如何获得对话框控件相对于父窗口(对话框窗口)的位置 及Invalidate(TRUE)的闪屏问题
- Android 获取控件相对于屏幕位置
- 获取控件在窗口上的相对位置以及修改背景色