It doesn't Paint for new TPoint?
I have this works fine:
void __fastcall DrawWave(TPaintBox *PaintBox, double
*data_array, int data_length)
{
PaintBox->Canvas->Brush->Color = clBlack;
PaintBox->Canvas->FillRect(PaintBox->Canvas->ClipRect);
PaintBox->Canvas->Pen->Color = clGreen;
TPoint points[512]; // <<===== Note here!
for(int i=0; i<data_length; i++) points[i] = Point(i,
(int)data_array[i]);
PaintBox->Canvas->Polyline(EXISTINGARRAY(points));
But, I have to force data_length = 512 (whatever the points
size
is declared).
Because data_length is variable, I tried this:
void __fastcall DrawWave(TPaintBox *PaintBox, double
*data_array, int data_length)
{
PaintBox->Canvas->Brush->Color = clBlack;
PaintBox->Canvas->FillRect(PaintBox->Canvas->ClipRect);
PaintBox->Canvas->Pen->Color = clGreen;
TPoint *points; // <<===== Note here!
points = new TPoint[data_length];
for(int i=0; i<data_length; i++) points[i] = Point(i,
(int)data_array[i]);
PaintBox->Canvas->Polyline(EXISTINGARRAY(points));
delete[] points;
No error compiling, but nothing was drawn in the PaintBox.
What I did wrong?