Export Guage as an Image

2 posts, 0 answers
  1. ravikiran jogu
    ravikiran jogu avatar
    11 posts
    Member since:
    Sep 2009

    Posted 11 Jun 2010 Link to this post

    Hi, How do I export radguage into an Image file?

    Thanks
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 15 Jun 2010 Link to this post

    Hi Ravikiran Jogu,

    You can use following code to same gauge image to file:

    private void ExportToImage()
    {
        SaveFileDialog saveImage = new SaveFileDialog();
        saveImage.Filter = "Bitmap (*.bmp)|*.bmp|PNG (*.png)|*.png";
        if (saveImage.ShowDialog() == true)
        {
            BitmapEncoder encoder = null;
            if (saveImage.SafeFileName.ToLower().EndsWith(".png"))
            {
                encoder = new PngBitmapEncoder();
            }
            else
            {
                encoder = new BmpBitmapEncoder();
            }
      
            using (Stream fileStream = saveImage.OpenFile())
            {
                ExportExtensions.ExportToImage(this.radGauge, fileStream, encoder);
            }
        }
    }


    All the best,
    Andrey Murzov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. DevCraft banner
Back to Top