home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 December / Chip_2001-12_cd1.bin / zkuste / delphi / kompon / d3456 / LSPICEDT.ZIP / D5 / LsPicEditorRegD5.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2001-09-05  |  1.1 KB  |  52 lines

  1. unit LsPicEditorRegD5;
  2.  
  3. interface
  4.  
  5. uses SysUtils, Controls, Graphics, TypInfo, LsPicEditorMainD5, LsPicEditorViewD5,
  6.      DsgnIntf, Forms;
  7.  
  8. type
  9.  TLsPictureEditor = class(TClassProperty)
  10.  public
  11.   function GetAttributes: TPropertyAttributes; override;
  12.   procedure Edit; override;
  13.  end;
  14.  
  15. procedure Register;
  16.  
  17. implementation
  18.  
  19.  
  20.  
  21. function TLsPictureEditor.GetAttributes: TPropertyAttributes;
  22. begin
  23.  Result := [paDialog]
  24. end;
  25.  
  26. procedure TLsPictureEditor.Edit;
  27. begin
  28.   Application.CreateForm(TPEMainForm, PEMainForm);
  29.   Application.CreateForm(TPEViewForm, PEViewForm);
  30.   with PEMainForm do
  31.   try
  32.     Image1.Picture := TPicture(GetOrdValue);
  33.     Image2.Picture := Image1.Picture;
  34.  
  35.     if ShowModal = mrOk then
  36.       if (GetPropType^.Name = 'TPicture') then
  37.         SetOrdValue(LongInt(Image1.Picture))
  38.       else
  39.         SetOrdValue(LongInt(Image1.Picture.Bitmap));
  40.   finally
  41.      Close;
  42.   end; { finally }
  43.   PEViewForm.Close;
  44. end;
  45.  
  46. procedure Register;
  47. begin
  48.   RegisterPropertyEditor(TypeInfo(TPicture), nil, '', TLsPictureEditor);
  49.   RegisterPropertyEditor(TypeInfo(TBitmap), nil, '', TLsPictureEditor);
  50. end;
  51.  
  52. end.