Autor Beitrag
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Fr 28.10.05 12:59 
Moinmoin.

Bin auch mal wieder da. Und zwar hab ich ein Problem mit TPicture. Ich würde gerne in zwei Edit-Boxen jeweils gewünschte Breite und Höhe eines Bildes eingeben und dann das Bild in Picture auf diese Größe stretchen. An besten einfach per Funktion:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
function StretchPictureTo(Width, Height: Integer; Source: TPicture): TPicture;
begin
//???
end;


Dafür gibt's doch bestimmt schon Methoden oder? Vielen Danke schonmal. ;)

coucou, WeBBy

_________________
Steht der Bauer im Gemüse, hat er später grüne Füße.
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Fr 28.10.05 16:19 
Hallo !
Ich hab mir mal eine Geschrieben weil Ich das gebraucht habe, kannst Sie ja noch auf deine Bedürfnisse anpassen.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
function GroesseAendern(Bild:String; Breite:Integer; Hoehe:Integer):String;
begin
 try
  Bmp := TBitmap.Create;
  Bmp.LoadFromFile(Bild+'.bmp');
  Bmp1 := TBitmap.Create;
  Bmp1.Width := Breite;
  Bmp1.Height := Hoehe;
  SetStretchBltMode(Bmp1.Canvas.Handle, Halftone);
  StretchBlt(Bmp1.Canvas.Handle,0,0,Bmp1.width,Bmp1.height,
  Bmp.Canvas.Handle,0,0,Bmp.Width,Bmp.Height,SRCCOPY);
  Bmp1.SaveToFile(Bild+'.bmp');
 finally
  Bmp.Free;
  Bmp1.Free;
 end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  GroesseAendern('test',200,200);
end;
WeBsPaCe Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Sa 29.10.05 23:57 
Moinmoin.

Jawoll. Danke. Die beiden Stretch-Funktionen kannte ich nicht. ;)

coucou, WeBBy

_________________
Steht der Bauer im Gemüse, hat er später grüne Füße.