简体   繁体   中英

delphi, Fill TdxMemData image column with some images in Ressource and display it in cxGrid

i have dxMemData with image Filed, and some png images located in ressource, i expose this images by singleton object like that:

  type
  ImagesRessource = class
  private
    constructor Create;
  public
    Man24: TPngImage;
    Woman24: TPngImage;
    RSMan24: TResourceStream;
    RSWoman24: TResourceStream;

    procedure Load_Man24;
    procedure Load_Woman24;
  end;

var
  Images: ImagesRessource;

implementation

constructor ImagesRessource.Create;
begin
  Load_Man24;
  Load_Woman24;
end;

procedure ImagesRessource.Load_Man24;    
begin 
     Man24 := TPngImage.Create;
     RSMan24 := TResourceStream.Create(hInstance, 'men_24', RT_RCDATA);
     Man24.LoadFromStream(RSMan24); 
end;

procedure ImagesRessource.Load_Woman24;    
begin
  Woman24 := TPngImage.Create;     
  RSWoman24 := TResourceStream.Create(hInstance, 'woman_24', RT_RCDATA);
  Woman24.LoadFromStream(RSWoman24);
end;

initialization 

Images := ImagesRessource.Create;

end.

after that, filling the dxMemeData like that

if(dxMemData1.FieldByName('isMale').AsBoolean) then        TBlobField(dxMemData1.FieldByName('SexeImg')).LoadFromStream(OverB.Besalama.Properties.V7.Images.RSMan24)
else        TBlobField(dxMemData1.FieldByName('SexeImg')).LoadFromStream(OverB.Besalama.Properties.V7.Images.RSWoman24);

the problem now with cxGrid, the image column dosnt't show any thing! i don't know why? or how to create cxgrid image ?

要在CxGrid列上显示图像,请将列属性设置为ImageComboBox ,并将图像设置为图像列表

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM