Drawing grid lines on a transparent image lazarus / 39-Graphics ---------------------------------------------------------------------- Tomi · 2024-04-24 14:15 Hello! I would like draw some lines for a grid in my program onto a TImage, but my code always shows a black background under the grid. As I did so far on the based on my modest knowledge and searching on the internet, I draw a TImage on a ScrollBox and make an other TImage on this and a bitmap onto this with the grid lines. Here is my code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.gridButtonMouseUp(Sender: TObject; Button: TMouseButton;  Shift: TShiftState; X, Y: Integer);var bm: TBitmap;  hlines,vlines: word;begin  if showgrid=true then  begin     showgrid:=false;     if gridon=true then     begin       FreeAndNil(gridimage);       gridon:=false;     end;  end  else  begin    showgrid:=true;    if gridon=false then    begin      gridimage:=TImage.Create(terrainScrBox);      gridimage.Parent:=terrainScrBox;      gridimage.Left:=0;      gridimage.Top:=0;      gridimage.width:=terrainCanvas.width; //terrainCanvas is a TImage component.      gridimage.height:=terrainCanvas.Height;      gridimage.Transparent:=true;      bm:=TBitmap.Create;      bm.width:=terrainCanvas.width;      bm.height:=terrainCanvas.Height;    bm.PixelFormat:=pf32Bit;      bm.Transparent:=true;      vlines:=tilewidth;      hlines:=tileheight;      bm.canvas.pen.color:=clBlue;      while vlines