Click here to Skip to main content
15,887,812 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Question[Message Deleted] Pin
iMikki4-Nov-09 7:57
iMikki4-Nov-09 7:57 
AnswerRe: Creating variables with a variable in its name Pin
Maximilien4-Nov-09 8:18
Maximilien4-Nov-09 8:18 
AnswerRe: Creating variables with a variable in its name Pin
«_Superman_»4-Nov-09 8:30
professional«_Superman_»4-Nov-09 8:30 
GeneralRe: Creating variables with a variable in its name Pin
iMikki4-Nov-09 8:49
iMikki4-Nov-09 8:49 
GeneralRe: Creating variables with a variable in its name Pin
Chris Losinger4-Nov-09 9:03
professionalChris Losinger4-Nov-09 9:03 
QuestionCards.dll question Pin
David Crow4-Nov-09 6:06
David Crow4-Nov-09 6:06 
AnswerRe: Cards.dll question Pin
«_Superman_»4-Nov-09 6:57
professional«_Superman_»4-Nov-09 6:57 
AnswerRe: Cards.dll question Pin
Mark Salsbery4-Nov-09 7:11
Mark Salsbery4-Nov-09 7:11 
Hi David,

When you move a card, it leaves behind two rectangles that need to be
repainted, to fill in the area where the card was.

For each move, I would calculate those two rectangles, use
the InvalidateRect() function (twice) to add those exposed rects
to the window's update region, then call UpdateWindow() to force an
immediate redraw.

In the WM_PAINT handler, you're probably already drawing all the cards
that are visible by iterating through a collection of some kind.
If you aren't already, you'll probably want to keep track of the
Z-order of the cards so cards on top get rendered last. That means
when a card is dragged, it needs to be moved to the top of the z-order
before doing the redraws that occur while moving the card. That should
solve the "becomes obscurred by the other cards constantly being redrawn"
issue, since the card being moved is drawn last.

To keep track of z-order, I would just use a simple collection like a
CTypedPtrArray, since generally only one card at a time is going to
change in z-order, and most likely its going to move to the top. You
can just remove the card object from the array and insert it back in
at the end of the array. The WM_PAINT handler then just needs to
draw cards in the same order they are in the array.

Hopefully that all makes sense.

Mark

Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

AnswerRe: Cards.dll question Pin
CPallini4-Nov-09 7:27
mveCPallini4-Nov-09 7:27 
AnswerRe: Cards.dll question Pin
Richard MacCutchan5-Nov-09 2:21
mveRichard MacCutchan5-Nov-09 2:21 
GeneralRe: Cards.dll question Pin
David Crow5-Nov-09 2:25
David Crow5-Nov-09 2:25 
Questionbuffer overrun Pin
nuttynibbles4-Nov-09 4:18
nuttynibbles4-Nov-09 4:18 
AnswerRe: buffer overrun Pin
David Crow4-Nov-09 4:30
David Crow4-Nov-09 4:30 
GeneralRe: buffer overrun Pin
Richard MacCutchan4-Nov-09 4:57
mveRichard MacCutchan4-Nov-09 4:57 
General[OT] Re: buffer overrun Pin
David Crow4-Nov-09 5:39
David Crow4-Nov-09 5:39 
GeneralRe: [OT] Re: buffer overrun Pin
Richard MacCutchan4-Nov-09 6:36
mveRichard MacCutchan4-Nov-09 6:36 
GeneralRe: [OT] Re: buffer overrun [modified] Pin
nuttynibbles4-Nov-09 11:14
nuttynibbles4-Nov-09 11:14 
GeneralRe: [OT] Re: buffer overrun Pin
Richard MacCutchan4-Nov-09 11:47
mveRichard MacCutchan4-Nov-09 11:47 
GeneralRe: [OT] Re: buffer overrun Pin
nuttynibbles6-Nov-09 1:44
nuttynibbles6-Nov-09 1:44 
GeneralRe: [OT] Re: buffer overrun Pin
MindCoder7912-Nov-09 19:54
MindCoder7912-Nov-09 19:54 
QuestionUpdated program-having a pointer error Pin
kbury4-Nov-09 3:23
kbury4-Nov-09 3:23 
AnswerRe: Updated program-having a pointer error Pin
Ibrahim Bello4-Nov-09 3:33
Ibrahim Bello4-Nov-09 3:33 
GeneralRe: Updated program-having a pointer error Pin
kbury4-Nov-09 3:41
kbury4-Nov-09 3:41 
GeneralRe: Updated program-having a pointer error Pin
Tim Craig4-Nov-09 13:55
Tim Craig4-Nov-09 13:55 
AnswerRe: Updated program-having a pointer error Pin
David Crow4-Nov-09 3:55
David Crow4-Nov-09 3:55 

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.