Re: Picture в TWinControl
От: Сергей  
Дата: 26.01.06 20:26
Оценка:
Здравствуйте, Nagir, Вы писали:

[..]
unit ImageWinControl;

interface

uses
        Windows, Messages, SysUtils, Classes, Controls, ExtCtrls;

type
        TImageWinControl = class (TWinControl)
        private
                mImage : TImage;
                procedure mSetImage (image : TImage);
                procedure imageChanged (Sender : TObject);
        protected
        public
                constructor Create (owner : TComponent); override;
        published
                property Image : TImage read mImage write mSetImage;
        end;

procedure Register;

implementation

procedure TImageWinControl.mSetImage (image : TImage);
begin
        if Assigned (image) then
        begin
                mImage.Assign (image);
                mImage.Picture.OnChange := imageChanged;
        end;
end;

procedure TImageWinControl.imageChanged (Sender : TObject);
begin
        Refresh;
end;

constructor TImageWinControl.Create (owner : TComponent);
begin
        inherited;
        mImage := TImage.Create (Self);
        InsertControl (mImage);
        mImage.Visible := true;
        mImage.Align := alClient;
        mImage.Picture.OnChange := imageChanged;
end;

procedure Register;
begin
        RegisterComponents ('ImageWinControl', [TImageWinControl]);
end;

end.

Оно?
http://rsdn.org/File/31732/spite.gif
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.