iwtmsimgde.pas

来自「TMS IntraWEb增强控件TMSIntraWeb_v2.3.2.1_D20」· PAS 代码 · 共 91 行

PAS
91
字号
{***************************************************************************}
{ TMS IntraWeb Component Pack Pro                                           }
{ for Delphi & C++Builder                                                   }
{ version 2.2                                                               }
{                                                                           }
{ written by TMS Software                                                   }
{            copyright ?2002 - 2004                                        }
{            Email : info@tmssoftware.com                                   }
{            Web : http://www.tmssoftware.com                               }
{                                                                           }
{ The source code is given as is. The author is not responsible             }
{ for any possible damage done due to the use of this code.                 }
{ The component can be freely used in any application. The complete         }
{ source code remains property of the author and may not be distributed,    }
{ published, given or sold in any form as such. No parts of the source      }
{ code can be included in any other component or application without        }
{ written authorization of the author.                                      }
{***************************************************************************}

unit IWTMSImgDE;
{$I TMSDEFS.INC}
interface

uses
  Forms, Windows, Classes, Controls, Dialogs, ExtDlgs, IWTMSImgCtrls, IWTMSImg,DesignIntf  , DesignEditors;
//{$IFDEF DELPHI6_LVL}
//  DesignIntf, DesignEditors
//{$ELSE}
//  DsgnIntf
//{$ENDIF}
//  ;


type
  TTIWAdvImageProperty = class(TClassProperty)
  public
    function GetAttributes: TPropertyAttributes; override;
    procedure Edit; override;
    procedure SetValue(const Value: String); override;
    function GetValue: String; override;
  end;

                                       
implementation

{ TTIWAdvImageProperty }

procedure TTIWAdvImageProperty.Edit;
var
  OpenDialog: TOpenPictureDialog;
begin
  inherited;
  OpenDialog := TOpenPictureDialog.Create(nil);

  OpenDialog.Filter := 'All (*.jpg;*.jpeg;*.gif;*.bmp)|*.jpg;*.jpeg;*.gif;*.bmp|JPEG Image File (*.jpg)|*.jpg|JPEG Image File (*.jpeg)|*.jpeg|GIF files (*.gif)|*.gif|Bitmap files (*.bmp)|*.bmp|';

  if OpenDialog.Execute then
  begin
    TIPicture(GetOrdValue).LoadFromFile(Opendialog.FileName);
    Designer.Modified;
  end;
  OpenDialog.Free;
end;

function TTIWAdvImageProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog];
end;

function TTIWAdvImageProperty.GetValue: String;
begin
  if not TIPicture(GetOrdValue).Empty then
    Result := '(TPicture)'
  else
    Result := '(None)';
end;

procedure TTIWAdvImageProperty.SetValue(const Value: String);
begin
  inherited;
  if Value = '' then
  begin
    TIPicture(GetOrdValue).Assign(nil);
    Designer.Modified;
  end;
end;



end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?