Home > Software engineering >  MFC C using the CDC MoveTo and LineTo crossed abnormal problem
MFC C using the CDC MoveTo and LineTo crossed abnormal problem

Time:11-08


As shown above, I draw a wave of similar controls, can be multiple coexist, each wave has a thread drawing in the memory, then the UI from memory replication at a fixed frequency, according to
It can be seen that the first wave, LINE4 and SIN3 have a abnormal line, but each of my lines cut data are independent impossible, corresponding code is as follows, please bosses gives give directions,
For (int I=0; i {
String line_name=showLine [I];
//determine whether paint finish, after the exit, back into the traversal
If (mPointsIndex [line_name] & gt; [line_name=mPoints]. The size () - 1)
{
ShowLine. Erase (showLine. The begin () + I);
break;
}
//line levels normalized
MemCDCWaveform. SelectObject (& amp; MPointsColor [line_name]);
POINTF PointF1=mPoints [line_name] [mPointsIndex [line_name]].
POINTF PointF2=mPoints [line_name] [mPointsIndex [line_name] + 1];
POINT Point1=NormalizationPoint (PointF1);
POINT Point2=NormalizationPoint (PointF2);
//determine whether the same point, the same point not painting
If (Point1. X==Point2. X & amp; & Point1. Y==Point2. Y)
{
MPointsIndex [line_name] + +;
}
The else
{
//thread marking is likely to fail, must undertake judging
If (MoveToEx (MemCDCWaveform, Point1. X, Point1. J y, NULL) & amp; & LineTo (MemCDCWaveform, Point2. X, Point2. Y))
{
MPointsIndex [line_name] + +;
}
}
}
  • Related