例如:m_myedit.Creat(WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_CSROLLBAR1)); 中CRect(0,0,0,0)的作用???
望各位高手不吝赐教,由于只有10分,所以只能悬赏10分,还望见谅。
Creat 中 CRect(0,0,0,0)含义
答案:4 悬赏:10
解决时间 2021-02-28 12:20
- 提问者网友:房东的猫
- 2021-02-27 19:42
最佳答案
- 二级知识专家网友:萌萌哒小可爱
- 2021-02-27 20:51
创建一个矩形。这里创建的空间你应该看不到。因为大小是0
坐标是(0,0,0,0)
坐标是(0,0,0,0)
全部回答
- 1楼网友:没感情的陌生人
- 2021-02-27 23:07
指定edit框的位置及大小,CRect(orgX, orgY, width, hight)将edit的框位置设置为:左上角顶点(orgX,orgY),右下角顶点(orgX+width, orgY+hight).
另附上MSDN的说明:
CEdit::Create
BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );
Return Value
Nonzero if initialization is successful; otherwise 0.
Parameters
dwStyle
Specifies the edit control’s style. Apply any combination of edit styles to the control.
rect
Specifies the edit control’s size and position. Can be a CRect object or RECT structure.
pParentWnd
Specifies the edit control’s parent window (usually a CDialog). It must not be NULL.
nID
Specifies the edit control’s ID.
Remarks
You construct a CEdit object in two steps. First, call the CEdit constructor, then call Create, which creates the Windows edit control and attaches it to the CEdit object.
When Create executes, Windows sends theWM_NCCREATE,WM_NCCALCSIZE,WM_CREATE, andWM_GETMINMAXINFO messages to the edit control.
These messages are handled by default by the OnNcCreate, OnNcCalcSize, OnCreate, and OnGetMinMaxInfo member functions in the CWnd base class. To extend the default message handling, derive a class from CEdit, add a message map to the new class, and override the above message-handler member functions. Override OnCreate, for example, to perform needed initialization for the new class.
Apply the following window styles to an edit control.
WS_CHILD Always
WS_VISIBLE Usually
WS_DISABLED Rarely
WS_GROUP To group controls
WS_TABSTOP To include edit control in the tabbing order
Example
void CMyView::OnInitialUpdate()
{
CView::OnInitialUpdate();
// dynamically create an edit control on the view
CEdit* pEdit = new CEdit;
pEdit->Create(ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER,
CRect(10, 10, 100, 100), this, 1);
}
- 2楼网友:虚伪的现实
- 2021-02-27 22:26
CRect(0,0,0,0)描述编辑框的位置和大小,一般是left,top,right,bottom4个参数,分别代表矩形的左,上,右,下的坐标
再看看别人怎么说的。
- 3楼网友:為→妳鎖鈊
- 2021-02-27 21:53
你的程序不对哦,应该是Create把
CRect(0,0,0,0),就是一左上角为坐标远点,以点(0,0)和(0,0)建立矩形
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯