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

C / C++ / MFC

 
AnswerRe: Problem Creating C++ Console App Pin
Patrice T28-Jan-17 13:17
mvePatrice T28-Jan-17 13:17 
Questionhelp me write a program Pin
Member 1296870327-Jan-17 3:13
Member 1296870327-Jan-17 3:13 
SuggestionRe: help me write a program Pin
Jochen Arndt27-Jan-17 3:25
professionalJochen Arndt27-Jan-17 3:25 
GeneralRe: help me write a program Pin
Member 1296870327-Jan-17 3:52
Member 1296870327-Jan-17 3:52 
AnswerNo Pin
Chris Losinger27-Jan-17 3:41
professionalChris Losinger27-Jan-17 3:41 
AnswerRe: help me write a program Pin
Stefan_Lang27-Jan-17 4:15
Stefan_Lang27-Jan-17 4:15 
AnswerRe: help me write a program Pin
Richard MacCutchan27-Jan-17 4:57
mveRichard MacCutchan27-Jan-17 4:57 
GeneralRe: help me write a program Pin
Rick York27-Jan-17 5:05
mveRick York27-Jan-17 5:05 
GeneralRe: help me write a program Pin
Richard MacCutchan27-Jan-17 6:15
mveRichard MacCutchan27-Jan-17 6:15 
GeneralRe: help me write a program Pin
Rick York27-Jan-17 8:24
mveRick York27-Jan-17 8:24 
GeneralRe: help me write a program Pin
Richard MacCutchan27-Jan-17 8:41
mveRichard MacCutchan27-Jan-17 8:41 
GeneralRe: help me write a program Pin
Member 1296870329-Jan-17 5:08
Member 1296870329-Jan-17 5:08 
GeneralRe: help me write a program Pin
Richard MacCutchan29-Jan-17 5:51
mveRichard MacCutchan29-Jan-17 5:51 
SuggestionRe: help me write a program Pin
David Crow30-Jan-17 2:19
David Crow30-Jan-17 2:19 
AnswerRe: help me write a program Pin
Patrice T28-Jan-17 13:10
mvePatrice T28-Jan-17 13:10 
Questionhow do i write this program? Pin
Member 1296870326-Jan-17 0:03
Member 1296870326-Jan-17 0:03 
AnswerRe: how do i write this program? Pin
Jochen Arndt26-Jan-17 0:29
professionalJochen Arndt26-Jan-17 0:29 
GeneralRe: how do i write this program? Pin
Stefan_Lang26-Jan-17 19:58
Stefan_Lang26-Jan-17 19:58 
AnswerRe: how do i write this program? Pin
Patrice T28-Jan-17 13:15
mvePatrice T28-Jan-17 13:15 
QuestionPerformance issue when drawing on MFC Pin
Member 162132325-Jan-17 10:59
Member 162132325-Jan-17 10:59 
AnswerRe: Performance issue when drawing on MFC Pin
leon de boer25-Jan-17 18:25
leon de boer25-Jan-17 18:25 
GeneralRe: Performance issue when drawing on MFC Pin
Member 162132326-Jan-17 10:28
Member 162132326-Jan-17 10:28 
GeneralRe: Performance issue when drawing on MFC Pin
leon de boer26-Jan-17 17:50
leon de boer26-Jan-17 17:50 
No worries and since you came back can I offer you a piece of code that can very quickly reject all the trivial shape areas that do not require drawing when moving in your current code.
You need to set the "dragging" flag to TRUE when you are moving a shape and set it back to FALSE when done dragging. I don't have the structures so you need to feed in x1,y1,x2,y2 into the two /* xxxxx */. So for each Area x1,y1 needs to be top left corner, x2,y2 lower right corner of the on screen minimum box around the shape. It puts an extra very fast test on redrawing a shape if the flag is set and I will leave you to work out what it does but it is commented Smile | :)
BOOL CanAreasOverlap (int Area1_x1, int Area1_y1, int Area1_x2, int Area1_y2, int Area2_x1, int Area2_y1, int Area2_x2, int Area2_y2){
	if (Area1_x1 > Area2_x2) return (FALSE);						// Area 1 completely to the right of Area 2 and can't overlap
	if (Area1_x2 < Area2_x1) return (FALSE);						// Area 1 completely to the left of Area 2 and can't overlap 
	if (Area1_y1 > Area2_y2) return (FALSE);						// Area 1 completely below Area 2 and can't overlap
	if (Area1_y2 < Area2_y1) return (FALSE);						// Area 1 completely above Area2 and can't overlap
	return (TRUE);													// The two square areas overlap to some degree
}

/* Set the dragging flag to TRUE when moving a shape */
BOOL dragging = FALSE;
OnDraw(CDC* pDC){
    
    for (int i = 0; i < numberObjects; i++){
	     if ((!dragging) || CanAreasOverlap(/* Moving shape is area 1*/, /*objects[i] shape is area 2*/)) { 
            objects[i]->DrawShape(pDC);
        }
    }
}

When you drag a shape and go to redraw
In vino veritas

Questionfree memory when constructor throw exception Pin
john563219-Jan-17 17:49
john563219-Jan-17 17:49 
AnswerRe: free memory when constructor throw exception Pin
rxantos19-Jan-17 19:05
rxantos19-Jan-17 19:05 

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.