Adding Custom Controls to Carousel for WinForms

14 posts, 0 answers
  1. Sultan
    Sultan avatar
    1 posts
    Member since:
    Apr 2009

    Posted 29 Apr 2009 Link to this post

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

  2. Peter
    Admin
    Peter avatar
    1143 posts
    Member since:
    Sep 2012

    Posted 30 Apr 2009 Link to this post

    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.

  3. Carolina
    Carolina  avatar
    4 posts
    Member since:
    May 2009

    Posted 27 May 2009 Link to this post

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

    thanks

  4. Peter
    Admin
    Peter avatar
    1143 posts
    Member since:
    Sep 2012

    Posted 28 May 2009 Link to this post

    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.

  5. Carolina
    Carolina  avatar
    4 posts
    Member since:
    May 2009

    Posted 28 May 2009 Link to this post

    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

  6. Deyan
    Admin
    Deyan avatar
    1933 posts
    Member since:
    Sep 2012

    Posted 29 May 2009 Link to this post

    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.

  7. Carolina
    Carolina  avatar
    4 posts
    Member since:
    May 2009

    Posted 03 Jun 2009 Link to this post

    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

     

  8. Deyan
    Admin
    Deyan avatar
    1933 posts
    Member since:
    Sep 2012

    Posted 04 Jun 2009 Link to this post

    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.

  9. Carolina
    Carolina  avatar
    4 posts
    Member since:
    May 2009

    Posted 04 Jun 2009 Link to this post

    Hi Deyan,
    My ticket ID is : 217415

    Regards,
    Carolina

  10. Herr
    Herr avatar
    23 posts
    Member since:
    Feb 2009

    Posted 22 Aug 2009 Link to this post

    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); 

  11. Peter
    Admin
    Peter avatar
    1143 posts
    Member since:
    Sep 2012

    Posted 24 Aug 2009 Link to this post

    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.

  12. Herr
    Herr avatar
    23 posts
    Member since:
    Feb 2009

    Posted 27 Aug 2009 Link to this post

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

  13. sieungo128
    sieungo128 avatar
    6 posts
    Member since:
    Sep 2010

    Posted 26 Jan 2011 Link to this post

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

  14. Peter
    Admin
    Peter avatar
    1143 posts
    Member since:
    Sep 2012

    Posted 31 Jan 2011 Link to this post

    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.

Back to Top