Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
[email protected] webmail 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 ( 15 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
Your Name: Code Language: