The function of two threads, each thread is respectively in the main interface drawing
HDC hdc1=GetDC () - & gt; M_hDC; GraphSin=: : new Graphics (hdc1); GraphAdvice=: : new Graphics (hdc1);
Thread1 { DisplaySinCurve (GraphSin); }
Thread2 { DisplayAdvice (GraphSin); }
DisplaySinCurve (Graphics * WorkGraphics) { Bitmap * CompatibleBitmap=: : new Bitmap (500, 250); Graphics * CompatibleGraphic=: : new Graphics (CompatibleBitmap); //drawing operations //double buffer the corresponding to the main interfaceWorkGraphics - & gt; DrawImage (CompatibleBitmap m_destStatic_Advice, 0, 0, CompatibleBitmap - & gt; GetWidth (), CompatibleBitmap - & gt; GetHeight (), UnitPixel); }
DisplayAdvice (Graphics * WorkGraphics) { Bitmap * CompatibleBitmap=: : new Bitmap (500, 250); Graphics * CompatibleGraphic=: : new Graphics (CompatibleBitmap); //drawing operations //double buffer the corresponding to the main interfaceWorkGraphics - & gt; DrawImage (CompatibleBitmap m_destStaticRect_Sin, 0, 0, CompatibleBitmap - & gt; GetWidth (), CompatibleBitmap - & gt; GetHeight (), UnitPixel); }
Problem is to run one thread drawing have no problem, after the operation, both appeared in front of things painted brush problem (double), you can't get rid of Daniel, please solve,
CodePudding user response:
Was supposed to be four curve, translation, as long as the draw another thread, the curve will appear eight or more,
CodePudding user response:
Advice only draw in one thread, easy to control the