1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| procedure TFrmTestDivers.StringGridDestImgDrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
var
i: Integer;
Text: string;
begin
if ARow = 0 then
begin
ListBoxSourceImg.Parent.Visible := True;
ListBoxSourceImg.Parent.BringToFront();
ListBoxSourceImg.Color := StringGridDestImg.FixedColor;
ListBoxSourceImg.Height := StringGridDestImg.RowHeights[0] + 4;
ListBoxSourceImg.Width := StringGridDestImg.DefaultColWidth + 4;
ListBoxSourceImg.Columns := 2;
ListBoxSourceImg.Items.Clear();
Text := StringGridDestImg.Cells[ACol, ARow];
for i := 1 to Length(Text) do
ListBoxSourceImg.Items.Add(Text[i]);
Application.ProcessMessages();
ImageDestination.Canvas.CopyRect(Classes.Rect(0, 0, ListBoxSourceImg.Width-4, ListBoxSourceImg.Height-4), ListBoxSourceImg.Canvas, Classes.Rect(0, 0, ListBoxSourceImg.Width-4, ListBoxSourceImg.Height-4));
StringGridDestImg.Canvas.CopyRect(Rect, ListBoxSourceImg.Canvas, Classes.Rect(0, 0, ListBoxSourceImg.Width-4, ListBoxSourceImg.Height-4));
MemoLogDrawCell.Lines.Add(Format('(%d,%d)=(%d,%d,%d,%d)', [ACol, ARow, Rect.Left, Rect.Top, Rect.Right, Rect.Bottom] ));
ListBoxSourceImg.Parent.Visible := False;
end;
end; |
Partager