Home > Back-end >  MFC drawing time is too long cause cannot display
MFC drawing time is too long cause cannot display

Time:10-23

 
Void CDrawTrendDlg: : OnBtnQuery () {
Sleep (60 * 1000);//remove after normal display picture
//MessageBox ("!" );//plus a messagebox, normal display picture
//RedrawWindow ();//no impact
CStatic * pDraw=(CStatic *) GetDlgItem (IDC_TREND_LINE);
//pDraw - & gt; RedrawWindow ();//no impact
CClientDC * pDC=new CClientDC (pDraw);

CRect the rect.
PDraw - & gt; GetClientRect (& amp; The rect);
The rect. Bottom -=20;
The rect. Left +=20;

PDC - & gt; MoveTo (the rect. Left, the rect. Bottom);
PDC - & gt; LineTo (the rect. Right, the rect. Bottom);
//arrow to add
PDC - & gt; MoveTo (the rect. Right - 5, the rect. Bottom - 5).
PDC - & gt; LineTo (the rect. Right, the rect. Bottom);
PDC - & gt; LineTo (the rect. Right - 5, the rect. Bottom + 5);

PDC - & gt; MoveTo (the rect. Left, the rect. Bottom);
PDC - & gt; LineTo (the rect. Left, the rect. Top);
//arrow to add
PDC - & gt; MoveTo (the rect. Left - 5, the rect. Top + 5);
PDC - & gt; LineTo (the rect. Left, the rect. Top);
PDC - & gt; LineTo (the rect. Left + 5, the rect. Top + 5);

//custom coordinate system
PDC - & gt; SetMapMode (MM_ANISOTROPIC);
PDC - & gt; SetViewportOrg (the rect. Left, the rect. Bottom);
PDC - & gt; SetWindowExt (5, the rect. Height ());
PDC - & gt; SetViewportExt (the rect. Width (), - the rect. Height ());

PDC - & gt; MoveTo (0, 0);
Int xhor;
Double yver;

Int m=100;
PDC - & gt; MoveTo (0, 0);
for(int i=1; I & lt;=4; + + I)
PDC - & gt; LineTo (I, m + I * 20);
}

The above code debugging, the image can also be normal, according to the runtime without image display, this is what causes, give advice or comments please everyone a great god?

CodePudding user response:

I glad to each master

CodePudding user response:

Why nobody answer

CodePudding user response:

What is used? The frequency of the call? What thread calls?

CodePudding user response:

CClientDC * pDC=new CClientDC (pDraw);

You are new, you delete??

CodePudding user response:

reference lhylhy reply: 3/f
cut with what? The frequency of the call? What thread calls?

There is only one main thread

CodePudding user response:

reference 4 floor draculamx response:
CClientDC * pDC=new CClientDC (pDraw);

You are new, you delete??

Here I copy only the part of the code, sorry miss, display and delete it doesn't matter

CodePudding user response:

May be drawing time is too long,
  • Related