Forum: Programmieren allgemein
by Uwe Raabe,
4. Aug 2014
Wohl eher nicht! Die linke Koordinate des Image bekommt man, wenn man vom Mittelpunkt die halbe Breite abzieht.
Beispiel: Rect(10, 10, 210, 210), ImageWidth = 100, ImageHeight = 100
P = CenterPoint(Rect) = (110, 110)
X = P.x - ImageWidth/2 = 110 - 50 = 60
Linke Kante des Bilds ist dann bei 60, was 50 von der linken Kante des Rechtecks (10) entfernt ist.
Rechte Kante des Bilds ist dann...
Forum: Programmieren allgemein
by Uwe Raabe,
21. Dez 2013
var
P: TPoint;
P := CenterPoint(Rect);
X := P.X - ImageList1.Width div 2;
Y := P.Y - ImageList1.Height div 2;
Forum: Programmieren allgemein
by Uwe Raabe,
21. Dez 2013
var
X, Y: Integer;
begin
if (ACol = 6) and (ARow >= StringGrid1.FixedRows) and (StringGrid1.Cells ='Eingang') then begin
{ eventuell noch zentrieren }
X := Rect.Left;
Y := Rect.Top;
ImageList1.Draw(StringGrid1.Canvas, X, Y, 0, true); { 0 = erstes Image in ImageList }
end;
end;