Pixel example for C++ Builder
void __fastcall TForm1::Lead1MouseDown (TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
long xycolor;
float xfraction, yfraction;
int xPixel, yPixel, xWidth;
Lead1->AutoRepaint = False;
//Translate mouse coordinates to fractions of the destination width and height
xfraction = float(X - Lead1->DstLeft) / Lead1->DstWidth;
yfraction = float(Y - Lead1->DstTop) / Lead1->DstHeight;
//Convert fractions to bitmap pixel coordinates
xPixel = (Lead1->SrcWidth * xfraction) + Lead1->SrcLeft;
yPixel = (Lead1->SrcHeight * yfraction) + Lead1->SrcTop;
//Make the whole line the same color as the pixel
xycolor = Lead1->Pixel[xPixel][yPixel];
xWidth = Lead1->BitmapWidth;
Y = yPixel;
for(X=0 ; X<xWidth; X++)
Lead1->Pixel[X][Y] = xycolor;
Lead1->ForceRepaint();
}