The current example illustrates how to customize the default PictureEdit editor so that it can accept a path to a graphic file as an EditValue and display a corresponding image.
Question Comments
Added By: zheng zhong at: 11/23/2012 1:30:57 AM
that way ,the file will be readed and readed again。
every time when shows the picture。
if I loading the file from website ,so slowly.
and
if you modify GraphicsEditViewInfo like this
class GraphicsEditViewInfo : PictureEditViewInfo
{
public GraphicsEditViewInfo(RepositoryItem item) : base(item) { }
public static Hashtable Images = new Hashtable();
public override object EditValue
{
get
{
return base.EditValue;
}
set
{
if (value != null && value.GetType() == typeof(System.String))
{
if (Images.ContainsKey(value))
{
try
{
base.EditValue = Images[value];
}
catch
{
base.EditValue = Item.ErrorImage;
}
}
else
{
try
{
using (WebClient w = new System.Net.WebClient())
{
var b = w.OpenRead(value.ToString());
var bitmap = new Bitmap(b);
Images.Add(value, bitmap);
}
base.EditValue = Images[value];
}
catch
{
base.EditValue = Item.ErrorImage;
}
}
}
else
base.EditValue = value;
}
}
}
Added By: Martin Schönholzer CH at: 2/16/2015 5:48:54 AMHi. I tried to use this tip to display external images. But in my case the RepositoryItemGraphicsEdit class is not found. What assembly contains this class and in what namespace?
Added By: Alisher (DevExpress Support) at: 2/16/2015 6:25:49 AMHi Martin,
We don't have a RepositoryItemGraphicsEdit class in our WinForms library. This example illustrates how to create it. Please download it to see the implementation.
Let us know of your results.
It worked, thanks Alisher. ;)