Smave
asked on
InvalidateRect
If I understand things correctly, if you want a certain area of a window to be redrawn you call the CWnd::InvalidateRect function.
Question: Given an edit box in a form: How do get the coordinates of said edit box (in the CRect structure) to plug into the CWnd::InvalidateRect function?
Thanx
Ace
Question: Given an edit box in a form: How do get the coordinates of said edit box (in the CRect structure) to plug into the CWnd::InvalidateRect function?
Thanx
Ace
ASKER
GetWindowRect(IDC_EDIT_Rec ordCNT);
gave me a compiler error.
error C2664: 'GetWindowRect' : cannot convert parameter 1 from 'const int' to 'struct tagRECT *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Do I need to create a member variable that is a control?
Thanx
Ace
gave me a compiler error.
error C2664: 'GetWindowRect' : cannot convert parameter 1 from 'const int' to 'struct tagRECT *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Do I need to create a member variable that is a control?
Thanx
Ace
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
One addition to what Dan Rollins suggested
1)The GetWindowRect returns the postion of the control in terms of screen coordinates, to get the position in terms of client coordinates - call ScreenToClient(rc);
Hope this helps
1)The GetWindowRect returns the postion of the control in terms of screen coordinates, to get the position in terms of client coordinates - call ScreenToClient(rc);
Hope this helps
You can use Invalidate() or InvalidateRect(0) for the Edit control itself (rather than get a rect for some subset of the screen or some other window).
Also, it is not needed, sinc rhe Edit control updates itself each time its contents change.
But to answer your question, use the GetWindowRect() member function of the control.
-- Dan