1

Topic: How to draw again window contents before it it was moved?

I will mix a mouse child a window over another parent a window. I want to achieve effect of a transparency child a window rather parent a window.  found out that OnPaint child windows it is caused after the window appears in a new place. That is it turns out, at first the window is moved to a new place, there is drawn with old contents, and then  its contents. A question: How to draw again contained before a window arises in a new place? It is a little prehistory: There is a window in which the big picture is drawn. The task at this window to enter the text in any position. This text is then added to a picture and saved. Decided to make by means of an additional window with transparent CEdit for text entering (not to implement all pieces on operation with the text independently). All is remarkable, but there was a problem with relocation of this frame (a window with a text box) over the first window with a picture. When I move the frame contents of a child window of the frame  with a time delay from for what form unpleasant effect of mismatch of the content of two windows. For copying of a child window-framework I do the following: void CTextBoxDlg:: OnWindowPosChanging (WINDOWPOS* lpwndpos) {CDialog:: OnWindowPosChanging (lpwndpos); Invalidate ();} And Here OnPaint which beret contents parent windows also draw the necessary area from it. void CTextBoxDlg:: OnPaint () {CPaintDC dc (this);//device context for painting//CDC MemDC;//BITMAP bit; CDC* pParentDC = m_pParentWnd-> GetDC (); CRect rect; GetWindowRect (&rect); dc. BitBlt (0, 0, rect. Width (), rect. Height (), pParentDC, rect.left, rect.top, SRCCOPY); dsc. Draw (dc); CDialog:: OnPaint ();}

2

Re: How to draw again window contents before it it was moved?

Hello, C0x, you wrote: C0x> C0x> void CTextBoxDlg:: OnWindowPosChanging (WINDOWPOS* lpwndpos) C0x> {C0x> CDialog:: OnWindowPosChanging (lpwndpos); C0x> Invalidate (); C0x>} C0x> 1. WM_WINDOWPOSCHANGING it is sent BEFORE the window position changed that you could correct kekie-nibud  or generally prevent relocation. Catch WM_WINDOWPOSCHANGED. 2. Yours Invalidate (); simply marks a window as needing copying; add after that UpdateWindow ();

3

Re: How to draw again window contents before it it was moved?

Hello, VladFein, you wrote: VF> Hello, C0x, you wrote: C0x>> C0x>> void CTextBoxDlg:: OnWindowPosChanging (WINDOWPOS* lpwndpos) C0x>> {C0x>> CDialog:: OnWindowPosChanging (lpwndpos); C0x>> Invalidate (); C0x>>} C0x>> VF> 1. WM_WINDOWPOSCHANGING it is sent BEFORE the window position changed that you could correct kekie-nibud  or generally prevent relocation. Catch WM_WINDOWPOSCHANGED. VF> 2. Yours Invalidate (); simply marks a window as needing copying; add after that UpdateWindow ();  there is a flashing. A problem that if to do so: void CTextBoxDlg:: OnWindowPosChanged (WINDOWPOS* lpwndpos) {CDialog:: OnWindowPosChanged (lpwndpos); Invalidate (); UpdateWindow ();} That window  is drawn in a new position with an old content then, twitches OnPaint and draws a new content. But OnWindowPosChanging the same not a variant since it works still before the window disappears in an old position. Therefore the new content is drawn in an old position, and then only it is moved to the new. It is necessary to update somehow a content still before the window appears in a new position, but already disappears in the old.

4

Re: How to draw again window contents before it it was moved?

Hello, C0x, you wrote: C0x> I Will mix a mouse child a window over another parent a window. C0x> I want to achieve effect of a transparency child a window rather parent a window. https://msdn.microsoft.com/ru-ru/librar … p/ms633540 (v=vs.85).aspx C0x> Debagom found out that OnPaint child windows it is caused after the window appears in a new place. It still a hogwash while you drag to you events can not come even PeekMessage can not return control of seconds. C0x> that is it turns out, at first the window is moved to a new place, there is drawn with old contents, and then  its contents. C0x> a question: How to draw again contained before a window arises in a new place? The idle time and  a method to have one more window, in the flow which it is impossible to drag, but on it the correct picture and to synchronize its position with that that drag, approximately as in directshow. And in the fullness of time to hide.

5

Re: How to draw again window contents before it it was moved?

Hello, C0x, you wrote: C0x> It is necessary to update somehow a content still before the window appears in a new position, but already disappears in the old. Two sentences: 1. On WM_WINDOWPOSCHANGING reduce height of a window to height Caption Bar; on WM_WINDOWPOSCHANGED (pen-) launch the short timer; on WM_TIMER draw the necessary window and recover its size. 2. Use Layered Windows

6

Re: How to draw again window contents before it it was moved?

Hello, VladFein, you wrote: VF> Hello, C0x, you wrote: C0x>> It is necessary to update somehow a content still before the window appears in a new position, but already disappears in the old. VF> two sentences: VF> 1. On WM_WINDOWPOSCHANGING reduce height of a window to height Caption Bar; on WM_WINDOWPOSCHANGED (a pen-) launch the short timer; on WM_TIMER draw the necessary window and recover its size. Most likely it leads to that will be constant  a window frame, or during its drag and drop it will not be visible. But it is necessary to try. Thanks. VF> 2. Use Layered Windows I can not invent as atop layered a window to draw transparent Edit so that in all this cumulative construction (Dialog + Transparent Edit) only the text drawn Edit  was not transparent. For certain it somehow can be made, but my attempts did not lead to success.

7

Re: How to draw again window contents before it it was moved?

Hello, C0x, you wrote: C0x> Invalidate (); C0x> UpdateWindow (); C0x>} C0x> [/code] C0x> That window  is drawn in a new position with an old content then, twitches OnPaint and draws a new content. But OnWindowPosChanging the same not a variant since it works still before C0x> the window disappears in an old position. Therefore the new content is drawn in an old position, and then only it is moved to the new. C0x> it is necessary to update somehow a content still before the window appears in a new position, but already disappears in the old. On the contrary, UpdateWindow (); it is not necessary to cause explicitly. And that turns out you do it 2 times. Also it is desirable  not all client area windows, but only that it is necessary to update (RECT). But generally a subject such, difficult and turbid.