Drwaing Problem

Hi, I am working in vc++ mfc.
I draw the line using CDC *dc; the line is drawn successfully. But if I minimize or move the dialog box. The line is automatically erased. Could please tell what I do?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
                CDC *dc;
		CRect r;
		GetClientRect(&r);
		r.top=0;
		r.bottom=300;
		r.right=595;
                dc=GetDlgItem(IDC_DRAWPIC)->GetDC();
		CBrush br(RGB(0,255,255));
		dc->SelectObject(br);
		dc->FillRect(r,&br);
                dc->MoveTo(50,250);
		dc->LineTo(550,250);
		dc->MoveTo(50,250);
		dc->LineTo(50,50);



I'm no expert on MFC, but presumably there's some kind of redraw/repaint event, that you'll need to handle to redraw your line.
Topic archived. No new replies allowed.