Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Carousel > Combine controls into one image to load into RadCarousel

Not answered Combine controls into one image to load into RadCarousel

Feed from this thread
  • Posted on Jun 28, 2011 (permalink)

    This question may belong in a different WinForms controls forum. If so, I apologize.

    Ultimately, I am wanting to show a carousel full of RadGridViews, but for performance's sake I am converting the RadGridView's into RadImageItems to be loaded into the carousel.

    I'd like to be able to put a label above the RadGridView as a title for the grid. So far I've tried adding a RadLabel and RadGridView to a RadItemsContainer, and then using the "GetAsBitmap" function to no avail.  

    RadImageItem image1 = new RadImageItem();
    image1.Image = rl.RootElement.GetAsBitmap(Brushes.White, 0, new SizeF(1, 1));
    rl.RootElement.GetAsBitmap(Brushes.White, 0, new SizeF(1, 1));
     
    RadImageItem image2 = new RadImageItem();
    image2.Image = grid.RootElement.GetAsBitmap(Brushes.White, 0, new SizeF(1, 1));
     
    RadItemsContainer ric = new RadItemsContainer();
    ric.Items.Add(image1);
    ric.Items.Add(image2);
     
    RadImageItem image3 = new RadImageItem();
    image3.Image = ric.GetAsBitmap(Brushes.White, 0, new SizeF(1, 1));
    image3.ImageKey = imageKey;

    (rl = previously declared RadLabel, grid = previously declared RadGridView)

    Thanks,

    Rob

    Reply

  • Peter Peter admin's avatar

    Posted on Jul 1, 2011 (permalink)

    Hello Rob,

    Thank you for the question.

    We have never tested such a scenario before, but I would like to suggest that you to put a RadGridView and RadLabel into a Panel and call Panel.GetAsBitmap method.

    Another possible solution is to try to combine two bitmaps - paint objects on different layers - here is an interesting article on how to do this.

    I hope this helps.

    Greetings,
    Peter
    the Telerik team
    Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.

    Reply

  • Say Hello to Telerik's PivotGrid for ASP.NET AJAX, Silverlight, WPF and WinForms. Now packed with OLAP support.
  • Posted on Jul 1, 2011 (permalink)

    Hey Peter,

    Thanks for your response.

    In case anyone ever has this same issue I was able to solve my problem by creating a bitmap of both the RadGridView and RadLabel, adding the images to a new Bitmap object, and then setting the RadImageItem's Image property to the new Bitmap.

    //Previously instantiated grid
    grid.BeginInit();
    grid.BindingContext = new BindingContext();
    grid.EndInit();
    grid.LoadElementTree();
     
    RadLabel descriptionLabel = new RadLabel();
    descriptionLabel.Text = "Success!";
    descriptionLabel.LoadElementTree();
        
    Bitmap gridBitmap = grid.RootElement.GetAsBitmap(Brushes.White, 0, new SizeF(1, 1));
    Bitmap labelBitmap = descriptionLabel.RootElement.GetAsBitmap(Brushes.White, 0, new SizeF(1, 1));
     
    Bitmap bmp = new Bitmap(x, y, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
     
    using (Graphics grfx = Graphics.FromImage(bmp))
    {
       grfx.DrawImage(labelBitmap, 0, 0);
       grfx.DrawImage(gridBitmap, 0, 15);
    }
           
    RadImageItem image = new RadImageItem();
    image.Image = bmp;

    Thanks again,

    Rob

    Reply

  • Peter Peter admin's avatar

    Posted on Jul 6, 2011 (permalink)

    Hello Rob,

    Thank you for the sharing this solution with the community.

    Regards,
    Peter
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Carousel > Combine controls into one image to load into RadCarousel
Related resources for "Combine controls into one image to load into RadCarousel"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]