This is a migrated thread and some comments may be shown as answers.

Adding Custom Controls to Carousel for WinForms

13 Answers 230 Views
Carousel
This is a migrated thread and some comments may be shown as answers.
Sultan
Top achievements
Rank 1
Sultan asked on 29 Apr 2009, 11:52 PM
Hi,
how can we add custom controls other than the ones provided with the RAD Suite?
thanks.

13 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 30 Apr 2009, 11:43 AM
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.
0
Carolina
Top achievements
Rank 1
answered on 27 May 2009, 09:07 PM
Peter,
can you add other example of this, in vb.net ?
How  can  I add a traditional label inside a carrousel?

thanks
0
Peter
Telerik team
answered on 28 May 2009, 08:27 AM
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.
0
Carolina
Top achievements
Rank 1
answered on 28 May 2009, 04:15 PM
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
0
Deyan
Telerik team
answered on 29 May 2009, 12:59 PM
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.
0
Carolina
Top achievements
Rank 1
answered on 03 Jun 2009, 09:32 PM
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

 

0
Deyan
Telerik team
answered on 04 Jun 2009, 07:53 AM
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.
0
Carolina
Top achievements
Rank 1
answered on 04 Jun 2009, 01:10 PM
Hi Deyan,
My ticket ID is : 217415

Regards,
Carolina
0
Herr
Top achievements
Rank 2
answered on 22 Aug 2009, 09:33 PM
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); 

0
Peter
Telerik team
answered on 24 Aug 2009, 11:31 AM
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.
0
Herr
Top achievements
Rank 2
answered on 27 Aug 2009, 09:00 PM
Jep, that's it. MinimumSize...
Thanks
0
sieungo128
Top achievements
Rank 1
answered on 26 Jan 2011, 10:58 AM
RadCarousel can't add control winform and can't add Usercontrol.
It can only add Item's contain in item Colection.
0
Peter
Telerik team
answered on 31 Jan 2011, 10:50 AM
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.
Tags
Carousel
Asked by
Sultan
Top achievements
Rank 1
Answers by
Peter
Telerik team
Carolina
Top achievements
Rank 1
Deyan
Telerik team
Herr
Top achievements
Rank 2
sieungo128
Top achievements
Rank 1
Share this question
or