zoukankan      html  css  js  c++  java
  • 使用 IntraWeb (18)


    TIWImage     //用于显示资源中的图片, 设计时通过 Picture 载入图片到资源
    TIWImageFile //用于显示给定路径或地址的图片
    TIWImageList //它继承于 TImageList, 一般用于图标管理, 一般也是在设计时载入图片以进入资源
    


    TIWImage 所在单元及继承链:
    IWCompExtCtrls.TIWImage < TIWDynamicImage < TIWCustomImage < TIWCustomControl < TIWBaseHTMLControl < TIWBaseControl < TIWVCLBaseControl < TControl < TComponent < TPersistent < TObject

    主要成员:
    property Picture: TPicture  //通过它载入图片; 设计时载入的图片会嵌入资源; 如果用它动态加载或许是为使用其更多功能, 否则不如用 TIWImageFile 
    property TransparentColor: TIWColor  //透明色; 只对 png、gif
    property OutputType: TIWImageOutput  //输出类型(也就是最终用到 Html 的类型): ioGIF, ioJPEG, ioPNG(默认)
    property JpegOptions: TIWJpegOptions //当 OutputType = ioJPEG 时的更多选项(下有详注)
    property RenderEmptyAsSpan: Boolean  //该属性默认 True, 表示没有图片可显示时将在 Html 中呈现为 SPAN 而不是 IMG
    property AltText: string    //当图像无法显示时的替换文本
    property AutoSize: Boolean  //自动大小
    property UseSize: Boolean   //使用指定的大小
    property BorderOptions: TIWBorderOptions  //边框选项; 主要是 Width 和 Color
    property Confirmation: string        //
    property DoSubmitValidation: Boolean //
    
    property OnClick: TNotifyEvent
    property OnMouseDown: TIWImageOnMouseDown
    property OnAsyncClick: TIWAsyncEvent
    property OnAsyncMouseDown: TIWAsyncEvent
    property OnAsyncMouseUp: TIWAsyncEvent
    
      {TIWJpegOptions 类的属性}
      property CompressionQuality: Shortint  //压缩比率; 默认 90
      property Performance: TJPEGPerformance //质量选项; jpBestQuality、jpBestSpeed(默认)
      property ProgressiveEncoding: Boolean  //是否使用递增式编码(图像较大时, 从模糊到清晰); 默认 False
      property Smoothing: Boolean            //是否平滑处理; 默认 True
    



    TIWImageFile 所在单元及继承链:
    IWCompExtCtrls.TIWImageFile < TIWCustomImage < TIWCustomControl < TIWBaseHTMLControl < TIWBaseControl < TIWVCLBaseControl < TControl < TComponent < TPersistent < TObject

    主要成员:
    property ImageFile: TIWFileReference //这是它最主要的属性; ImageFile.Filename 或 ImageFile.URL
    property Cacheable: Boolean  //是否使用缓存
    property AltText: string   //
    property AutoSize: Boolean //
    property UseSize: Boolean  //
    property BorderOptions: TIWBorderOptions //
    property Confirmation: string            //
    property DoSubmitValidation: Boolean     //
    
    property OnClick: TNotifyEvent
    property OnMouseDown: TIWImageOnMouseDown
    property OnAsyncClick: TIWAsyncEvent
    property OnAsyncMouseDown: TIWAsyncEvent
    property OnAsyncMouseUp: TIWAsyncEvent
    



    TIWImageList 所在单元及继承链:
    IWImageList.TIWImageList < TImageList < TDragImageList < TCustomImageList < TComponent < TPersistent < TObject

    主要成员:
    property BkColor: TColor    //背景色
    property BlendColor: TColor //混合色; 在产生 DrawingStyle 需要的不同效果时需要
    property ColorDepth: TColorDepth  //颜色深度
    property DrawingStyle: TDrawingStyle //dsFocus(焦点状态)、dsNormal(正常,默认)、dsSelected(选择状态)、dsTransparent(透明)
    property ImageType: TImageType       //图像类型: itImage(原图像)、itMask(遮罩)
    property ShareImages: Boolean  //?
    property Masked: Boolean  //?
    
    property Count: Integer   //
    property Height: Integer  //
    property Width: Integer   //
    
    property OnChange: TNotifyEvent  //
    
    function ExtractImageToCache(AImageIndex: Integer; const ACacheType: TCacheType): string //提取到缓存, 返回路径;  
                                                                                             //IW.CacheStream.TCacheType 是缓存期选项, 默认 ctOneTime
    											 //TCacheType = (ctOneTime、ctApp、ctSession、ctForm)
    


    示例(通过 TIWImageFile 遍历 TIWImageList 中的图片):
    var i: Integer;
    
    procedure TIWForm1.IWButton1AsyncClick(Sender: TObject; EventParams: TStringList);
    var
      imgFilePath: string;
    begin
      imgFilePath := IWImageList1.ExtractImageToCache(i);
      IWImageFile1.ImageFile.Filename := imgFilePath;
      Inc(i);
      if i = IWImageList1.Count then i := 0;
    end;
    


  • 相关阅读:
    六、MySQL系列之数据备份(六)
    一:MySQL系列之基本介绍(一)
    第十一篇:面向对象之属性方法
    第十篇:面向对象系列之三大特性(二)
    Python开发之路:目录篇
    Linux基础知识(二)
    前端CSS规范整理
    如何使用BMap.Point传递变量、存储数据?
    百度地图API应用之获取用户的具体位置
    Bootstrap入门一:Hello Bootstrap
  • 原文地址:https://www.cnblogs.com/del/p/3788807.html
Copyright © 2011-2022 走看看