Psst.. new poll here.
[email protected] web/email now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!
Paste
Pasted as Delphi by AnDrii ( 16 years ago )
Ñам клаÑÑ:
unit KLimg;
interface
uses
Classes, ExtCtrls;
type
Kimg=class(Timage)
private
img:Timage;
h,w:Integer;
public
Constructor Create(im:TComponent); override;
procedure nowy(img1:Timage; h1,w1:Integer) ;
function NewImg:TImage;
end;
implementation
constructor Kimg.Create(im:TComponent);
begin
inherited Create(im);
end;
procedure Kimg.nowy(img1:Timage; h1,w1:Integer) ;
begin
img:=img1;
h:=h1;
w:=w1;
img.Canvas.StretchDraw(Rect(0, 0, h, w), img.Picture.bitmap);
img.Picture.Bitmap.Height:=w;
img.Picture.Bitmap.Width:=h;
img.Height:=w;
img.Width:=h;
end;
function Kimg.NewImg:TImage;
begin
result:=img;
end;
end.
КуÑок кода иÑпользующий клаÑÑ:
procedure TForm1.Button3Click(Sender: TObject);
var
Img:Kimg;
h,w:Integer;
begin
img:=Kimg.Create(nil);
h:=strtoint(edit1.text);
w:=strtoint(edit2.text);
img.nowy(image1,h,w);
image1:=img.newimg;
end;
Revise this Paste
Children: 8180