Click here to Skip to main content
15,909,324 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Window Region and Placement Pin
Dov Sherman17-Jul-02 4:58
Dov Sherman17-Jul-02 4:58 
GeneralRe: Window Region and Placement Pin
Joaquín M López Muñoz17-Jul-02 5:09
Joaquín M López Muñoz17-Jul-02 5:09 
GeneralRe: Window Region and Placement Pin
Dov Sherman17-Jul-02 5:47
Dov Sherman17-Jul-02 5:47 
GeneralRe: Window Region and Placement Pin
Joaquín M López Muñoz17-Jul-02 6:54
Joaquín M López Muñoz17-Jul-02 6:54 
GeneralRe: Window Region and Placement Pin
Dov Sherman17-Jul-02 7:10
Dov Sherman17-Jul-02 7:10 
GeneralRe: Window Region and Placement Pin
Joaquín M López Muñoz17-Jul-02 7:47
Joaquín M López Muñoz17-Jul-02 7:47 
GeneralRe: Window Region and Placement Pin
Dov Sherman17-Jul-02 8:24
Dov Sherman17-Jul-02 8:24 
GeneralRe: Window Region and Placement Pin
Dov Sherman19-Jul-02 2:17
Dov Sherman19-Jul-02 2:17 
I found a solution. For the curious, I will post it here:

The main problem is that the window needs to change its HRGN shape and its position at the same time. Since the new shape will not be correct until the window is in the new position, I needed the window to redrawn only when both the new HRGN and the new position have been set but I still needed to restore the background in areas of the old shape which were not part of the new shape.

<br />
void CAnimateWnd::UpdateRgnAndPos(HRGN hNewRgn, int iPosX, int iPosY)<br />
{<br />
HRGN hOldRgn = CreateRectRgn(0, 0, 0, 0); // make blank region<br />
GetWindowRgn(hOldRgn);<br />
<br />
HRGN hOffRgn = CreateRectRgn(0, 0, 0, 0); // make blank region<br />
CombineRgn(hOffRgn, hNewRgn, NULL, RGN_COPY); // make a copy<br />
OffsetRgn(hOffRgn, iPosX - m_iOldPosX, iPosY - m_iOldPosY); // compensate for later movment<br />
<br />
HRGN hCombinedRgn = CreateRectRgn(0, 0, 0, 0); // make blank region<br />
CombineRgn(hCombineRgn, hOffRgn, hOldRgn, RGN_OR); // combine region so that lost area gets deleted<br />
<br />
SetWindowRgn(hCombinedRgn, FALSE); // don't redraw yet<br />
<br />
SetWindowPos(iPosX, iPosY, 100, 100, SWP_NOACTIVATE); // change position<br />
<br />
SetWindowRgn(hNewRgn, TRUE); // redraw now so that lost areas of combined region are restored<br />
<br />
Invalidate(TRUE); // make it pretty<br />
<br />
m_iOldPosX = iPosX; // remember old position for next time<br />
m_iOldPosY = iPosY;<br />
}<br />

GeneralRe: Window Region and Placement Pin
Philippe Mori17-Jul-02 3:10
Philippe Mori17-Jul-02 3:10 
GeneralCListCtrl OnKeyDown message. Pin
Fred dB.16-Jul-02 23:28
Fred dB.16-Jul-02 23:28 
GeneralRe: CListCtrl OnKeyDown message. Pin
Scot Brennecke17-Jul-02 19:39
professionalScot Brennecke17-Jul-02 19:39 
GeneralRe: CListCtrl OnKeyDown message. Pin
Fred dB.17-Jul-02 21:06
Fred dB.17-Jul-02 21:06 
GeneralRe: CListCtrl OnKeyDown message. Pin
Fred dB.18-Jul-02 2:59
Fred dB.18-Jul-02 2:59 
GeneralHelp files... Pin
Neha16-Jul-02 23:24
Neha16-Jul-02 23:24 
GeneralRe: Help files... Pin
[James Pullicino]17-Jul-02 4:57
[James Pullicino]17-Jul-02 4:57 
QuestionCustomdraw ? Pin
Brian van der Beek16-Jul-02 22:57
Brian van der Beek16-Jul-02 22:57 
QuestionCSocket, CArchive connect to java server? Pin
Anonymous16-Jul-02 22:36
Anonymous16-Jul-02 22:36 
AnswerRe: CSocket, CArchive connect to java server? Pin
Brian Azzopardi16-Jul-02 23:27
Brian Azzopardi16-Jul-02 23:27 
General"Installing" ISAPI Pin
Hans Ruck16-Jul-02 22:09
Hans Ruck16-Jul-02 22:09 
GeneralAccess denied when trying to access IE documents in frames, in which loaded docs from different domains Pin
Alex Cramer16-Jul-02 21:19
Alex Cramer16-Jul-02 21:19 
GeneralHelp me ..Doubts on VC++ DhtmlEdit Controll for IE5[Table insert,Paste html...] Pin
Ranjith.e.Nair16-Jul-02 20:44
Ranjith.e.Nair16-Jul-02 20:44 
Generalfont editor Pin
surbinsho16-Jul-02 20:04
surbinsho16-Jul-02 20:04 
GeneralRe: font editor Pin
Tibor Blazko16-Jul-02 20:25
Tibor Blazko16-Jul-02 20:25 
GeneralRe: font editor Pin
Roger Allen16-Jul-02 23:42
Roger Allen16-Jul-02 23:42 
GeneralLatest CAD/CAM/CAE/GIS/PCB/EDA/FEA software HERE! Pin
Anonymous16-Jul-02 14:54
Anonymous16-Jul-02 14:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.