Hola de nuevo, paar tu segunda pregunta, puedes hacerlo como te indica neftalí y despues utilizar TextOut
Cita:
Empezado por Neftali
Si no recuerdo al, TCanvas posee un método (TextWidth) que te permite saber el ancho en Pixels que ocupará el texto que le pasas (por parámetro) con la fuente actual.
Una vez que hayas ejecutado esa función y sepas lo que el texto ocupa, ya sólo debes mostrarlo centrado; Sabiendo el With del Canvas y el Width del texto es trivial.
|
Código Delphi
[-]
with Image1.Canvas do
begin
Font.Color := clRed;
SetBkMode(Handle, TRANSPARENT);
Canvas.TextOut(45, 45, 'Texto');
end;
o utilizar DrawText:
Código Delphi
[-]
var
Cad : String;
Rect : TRect;
begin
Rect.Left := Image1.Left;
Rect.Top := Image1.Top;
Rect.Right := Image1.Width;
Rect.Bottom := Image1.Height;
Cad := 'Texto';
DrawText(Image1.Canvas.Handle,PChar(Cad), StrLen(PChar(Cad)),Rect, DT_CENTER or DT_VCENTER or DT_SINGLELINE);
Self.Refresh;
Utilizas un With paar no repetir Image1.
Saluditos