We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Image to ImageExt

Hi,

I am using a BarItem within an XPToolBar. I need users of my UserControl to provide a System.Drawing.Image. However, when creating the BarItem, the Image property expects an ImageExt and not a System.Drawing.Image.

Can you please explain how I can convert an Image to an ImageExt?

Thanks!

Regards,
Russell

3 Replies

RF Rashidha F Syncfusion Team July 10, 2007 12:03 PM UTC

Hi Russell,

Thanks for using Syncfusion Products.

The following code snippet which illustrates how to set an System.Drawing.Image to ImageExt.

string url= "Specify the path of the Image";
System.Drawing.Image image=new Bitmap(url);
this.xpToolBar1.Bar.Items[0].Image = new Bitmap(image);

Please let me know if this helps.

Thanks and Regards,
Rashidha.


RC Russell Coombes July 10, 2007 02:06 PM UTC

Hi Rashidha,

Thanks for your reply.

I am given the image as a parameter to a method, and it is within the method that I need to convert an image to an imageExt. So I'm afraid your example will not work for me.

The Image object is given to me by retrieving it from the indexer on an ImageList. I would be grateful if your next answer would consider this scenario.

Regards,
Russell

>Hi Russell,

Thanks for using Syncfusion Products.

The following code snippet which illustrates how to set an System.Drawing.Image to ImageExt.

string url= "Specify the path of the Image";
System.Drawing.Image image=new Bitmap(url);
this.xpToolBar1.Bar.Items[0].Image = new Bitmap(image);

Please let me know if this helps.

Thanks and Regards,
Rashidha.


RF Rashidha F Syncfusion Team July 11, 2007 12:31 PM UTC

Hi Russell,

Thanks for the update.

Please refer the following code snippet which will helps to achieve your requirement in your application.

private void Form1_Load(object sender, EventArgs e)
{
this.xpToolBar1.Bar.Items[0].Image = Images(imageList1.Images[0]);
}

private ImageExt Images(System.Drawing.Image img)
{
ImageExt x = (ImageExt)(img);
return x;
}

Please refer the attached sample and let me know if this helps.

http://websamples.syncfusion.com/samples/Tools.Windows/F63606_1/main.htm

Thanks and Regards,
Rashidha.

Loader.
Live Chat Icon For mobile
Up arrow icon