Click here to Skip to main content
15,889,651 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
AnswerRe: free memory when constructor throw exception Pin
«_Superman_»19-Jan-17 19:32
professional«_Superman_»19-Jan-17 19:32 
AnswerRe: free memory when constructor throw exception Pin
Albert Holguin20-Jan-17 10:14
professionalAlbert Holguin20-Jan-17 10:14 
QuestionSend data to POS Printer by USB Pin
Member 1286002219-Jan-17 16:10
Member 1286002219-Jan-17 16:10 
AnswerRe: Send data to POS Printer by USB Pin
«_Superman_»19-Jan-17 19:48
professional«_Superman_»19-Jan-17 19:48 
SuggestionRe: Send data to POS Printer by USB Pin
David Crow20-Jan-17 3:15
David Crow20-Jan-17 3:15 
QuestionLight weight solution for distrubted memory map Pin
Member 380393118-Jan-17 16:12
Member 380393118-Jan-17 16:12 
QuestionGdiplus: DrawImage not working Pin
Member 162132314-Jan-17 3:28
Member 162132314-Jan-17 3:28 
AnswerRe: Gdiplus: DrawImage not working Pin
leon de boer14-Jan-17 23:45
leon de boer14-Jan-17 23:45 
GeneralRe: Gdiplus: DrawImage not working Pin
Member 162132325-Jan-17 10:57
Member 162132325-Jan-17 10:57 
Questionwhat?where? Pin
Member 1294982214-Jan-17 1:54
Member 1294982214-Jan-17 1:54 
AnswerRe: what?where? Pin
Afzaal Ahmad Zeeshan14-Jan-17 2:59
professionalAfzaal Ahmad Zeeshan14-Jan-17 2:59 
AnswerRe: what?where? Pin
Patrice T14-Jan-17 16:03
mvePatrice T14-Jan-17 16:03 
AnswerRe: what?where? Pin
jeron116-Jan-17 5:15
jeron116-Jan-17 5:15 
GeneralRe: what?where? Pin
Daniel Pfeffer16-Jan-17 5:22
professionalDaniel Pfeffer16-Jan-17 5:22 
GeneralRe: what?where? Pin
NotPolitcallyCorrect16-Jan-17 9:20
NotPolitcallyCorrect16-Jan-17 9:20 

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.