Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Carousel > Adding Custom Controls to Carousel for WinForms

Not answered Adding Custom Controls to Carousel for WinForms

Feed from this thread
  • Sultan avatar

    Posted on Apr 29, 2009 (permalink)

    Hi,
    how can we add custom controls other than the ones provided with the RAD Suite?
    thanks.

    Reply

  • Peter Peter admin's avatar

    Posted on Apr 30, 2009 (permalink)

    Hi Sultan,

    Thank you for writing. Yes, you can add custom control using RadHostItem class. Please refer the Documentation and see sample code below:

    MyControl control = new MyControl(); 
    control.Size = new Size(100, 100);//set size manually 
    RadHostItem item = new RadHostItem(control); 
    item.MinSize = new Size(100, 100); 
    radCarousel1.Items.Add(item); 

    Hope this helps.

    Greetings,
    Peter
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.

    Reply

  • Carolina avatar

    Posted on May 27, 2009 (permalink)

    Peter,
    can you add other example of this, in vb.net ?
    How  can  I add a traditional label inside a carrousel?

    thanks

    Reply

  • Peter Peter admin's avatar

    Posted on May 28, 2009 (permalink)

    Hi Carolina ,

    Thank you for your interest in RadControls. You can add MSLabel inside a RadCarousel using the following lines of code:

    Dim control As Label = New Label 
    control.Text = "Hello" 
    Dim item As Telerik.WinControls.RadHostItem = New Telerik.WinControls.RadHostItem(control) 
    item.MinSize = New Size(40, 20) 
    control.MinimumSize = New Size(40, 20) 
    RadCarousel1.Items.Add(item) 

    Don't hesitate to contact us if you have other questions.

    All the best,
    Peter
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.

    Reply

  • Carolina avatar

    Posted on May 28, 2009 (permalink)

    Thank Peter, the example works ok.
    It is possible load an activex like an element of carousel?
    I'm testing, but I have this exception, "System.Windows.Forms.AxHost+InvalidActiveXStateException'."

    Thanks

    Reply

  • Deyan Deyan admin's avatar

    Posted on May 29, 2009 (permalink)

    Hello Carolina,

    Thanks for getting back to us. In general, we have not tested our Carousel with ActiveX items. However, I would like to ask you to prepare a sample project that reproduces the mentioned exception that we can use to investigate the case in order to be able to provide proper support.

    Please note that you are not able to upload files in our forums. Therefore I would ask you to open a support ticket so that you can send us your project.

    Thanks for your time. I am looking forward to receiving the requested details.

    Best wishes,
    Deyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.

    Reply

  • Carolina avatar

    Posted on Jun 3, 2009 (permalink)

    Hi Deyan,
    Thank's , I will generate a ticket, and send it the whole project.

    From the other hand, here is an example of my source code.
    In a carousel , I want to integrate a COM component(in this case flash component) such as a button.
    The COM Component loads as a button in a carousel, but it doesn't show flash movie.

     

     



    Private

    Private

     

    Sub RadButtonElement2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadButtonElement2.Click

     

     

    Dim control_flash As AxShockwaveFlashObjects.AxShockwaveFlash = New AxShockwaveFlashObjects.AxShockwaveFlash     
       control_flash.Size =
    New System.Drawing.Size(125, 76)

     

     


    Dim
    item_flash As Telerik.WinControls.RadHostItem = New Telerik.WinControls.RadHostItem(control_flash)

     

        item_flash.MinSize =

    New Size(100, 100)

     

        control_flash.MinimumSize =

    New Size(40, 20)

     

        RadCarousel1.Items.Add(item_flash)

     

    End Sub


    Regards,
    Carolina

     

    Reply

  • Deyan Deyan admin's avatar

    Posted on Jun 4, 2009 (permalink)

    Hi Carolina ,

    Thanks for sending us your code. In general, your code is correct. Hosting controls in RadCarousel is a common scenario. However, I would still need your demo project so that I can take a thorough look and try to be of help. Thanks for your time. I am looking forward to receiving the requested application .

    Regards,
    Deyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.

    Reply

  • Carolina avatar

    Posted on Jun 4, 2009 (permalink)

    Hi Deyan,
    My ticket ID is : 217415

    Regards,
    Carolina

    Reply

  • Michael avatar

    Posted on Aug 22, 2009 (permalink)

    Hi All,
    the example didn't work for me! May-be, I'm doing something wrong?
    Here is my Code:
    RadHostItem i1 = new RadHostItem(new Button()); 
    i1.MinSize = new Size(100, 100); 
    RadHostItem i2 = new RadHostItem(new Button()); 
    i2.MinSize = new Size(100, 100);  
    radCarousel1.Items.Add(i1); 
    radCarousel1.Items.Add(i2); 

    Reply

  • Peter Peter admin's avatar

    Posted on Aug 24, 2009 (permalink)

    Hi Michael,

    Thank you for writing. Your code looks ok. Could you please try setting the Text and the MinimumSize for the Buttons as well. I hope this helps. Don't hesitate to contact us if you have other questions.

    Sincerely yours,
    Peter
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.

    Reply

  • Michael avatar

    Posted on Aug 27, 2009 (permalink)

    Jep, that's it. MinimumSize...
    Thanks

    Reply

  • sieungo128 avatar

    Posted on Jan 26, 2011 (permalink)

    RadCarousel can't add control winform and can't add Usercontrol.
    It can only add Item's contain in item Colection.

    Reply

  • Peter Peter admin's avatar

    Posted on Jan 31, 2011 (permalink)

    Hello Nguyen,

    Thank you for writing.

    You cannot add user controls directly to RadCarousel's Items collection.
    You should add the User Control to RadHostItem and add the RadHostItem to the Items collection, for example:
    RadHostItem i1 = new RadHostItem(new MyUserControl());
    i1.MinSize = new Size(100, 100);
    radCarousel1.Items.Add(i1);

    I hope this helps.

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

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Carousel > Adding Custom Controls to Carousel for WinForms
Related resources for "Adding Custom Controls to Carousel for WinForms"

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