MFC: dynamically created CEdit is not animated and does not change the appearance

375 Views Asked by At

Does anyone know why my dynamically created CEdit is not animated like a CEdit control created in the dialog editor?

When hovering with the cursor over the control, the color of the frame does not change (In normal case the gray color changes slightly) - When Selected, the color of the frame does not change either (should be blue).

CRect staticEditRect = CRect();
m_ctrlEditStatic.GetWindowRect(&staticEditRect);
ScreenToClient(&staticEditRect);

// offset position
CONST INT defaultPosVertSpace = 7;
staticEditRect.OffsetRect(0, staticEditRect.Height() + defaultPosVertSpace);

// create dynamic Edit 
CEdit* ctrlEditDynamic = new CEdit;
ctrlEditDynamic->Create(WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER, staticEditRect, this, IDC_EDIT_NEW_DYNAMIC);
ctrlEditDynamic->SetFont(m_ctrlEditStatic.GetFont());

Here is an example of what it usually looks like: Blue border while focused

And here is a screenshot of what my CEdit Control looks like: My CEdit control (Nothing happend)

My goal was to add, depending on the case, dynamic CEdit controls that look exactly like the original (say size, appearance, behavior...). I have already tried a few things, but can't find the damn reason.

Can someone help me with this?

0

There are 0 best solutions below