I load images from database to TImageEnMView,when I load the record,I want to bind some string value such as "Id" field value to the image item,How should I do?
You might be able by setting one of the TImageEnMView text properties to the string from the database or by adding the string to an EXIF parameter. ImageEnMView1.ImageTopText[i] := iDimensions + ' ' + iColor; ImageEnMView1.ImageBottomText[i] := 'Frame ' + IntToStr(i + 1); The text is not saved with the image.
You might also look at TIEDictionary class in hyieutils.pas. I have never used TIEDictionary, so I do not know much about it. Look in the help file or in the online help for TIEDictionary or EXIF.
Another possible way is with WriteHiddenText/ReadHiddenText. TImageEnProc.WriteHiddenText
Declaration function WriteHiddenText(text: AnsiString): Integer;
Description WriteHiddenText and WriteHiddenData write hidden text or raw data within a true color image. Hidden information is stored inside the image (uses a pixel color modulation) and is independent of the image file format. Use WriteHiddenText to write a simple string or WriteHiddenData to write a block of bytes (e.g. to embed a hidden image or sound).
Note: The hidden text will be lost if you save the image as Jpeg or if you subsample the colors.
Example // Hide "Copyright by XYZ" in 'alfa.tif' ImageEnView1.Proc.WriteHiddenText('Copyright by XYZ'); ImageEnView1.IO.SaveToFile('D:\alfa.tif');
// Read simple string from 'alfa.tif' ImageEnView1.IO.LoadFromFile('D:\alfa.tif'); mystring := ImageEnView1.Proc.ReadHiddenText;
Thanks for ur reply. Maybe I did not express my request clearly,I just need the bind value when the image is loaded to the TImageEnMView,and I can get the value when the user doubleClick the image item.When I set the topText property,I don't know how to to hide it.