Hi,
I have this following code;
Public Sub SetIcons(icons() As icontypes) Dim stemp As String = "name" Dim i As Integer = 0 Dim tools(icons.Length - 1) As UltraWinToolbars.ToolBase For Each Icon As icontypes In icons Dim buttontool As New Infragistics.Win.UltraWinToolbars.ButtonTool(stemp + i.ToString()) tools(i) = buttontool i += 1 Dim Appearance1 As Infragistics.Win.Appearance = New Infragistics.Win.Appearance() Appearance1.Image = ImageList1.Images(Icon.ToString()) buttontool.SharedPropsInternal.AppearancesSmall.Appearance = Appearance1 buttontool.SharedPropsInternal.Caption = "Temp" + i.ToString() Tbm1.Tools.Add(buttontool) Next End Sub
this code receives an array of enum type (enum named icontypes), each array element is operated upon. Each enum value is converted into string and looked at in the imagelist control for image present against its value, that image is assigned to a newly created button tool which then is added to the toolbar. After this code completes I expect to see a number of icons with images in the Tbm1, but I see nothing. Whats going wrong here.
Thanks.
Hello,
Do you have the 'DisplayStyle' on the 'SharedPropsInternal' object of the tool set to 'ImageAndText'? If this is true and you still unable to see the image, please check if the tool is being added to any toolbar. If you are adding it only in the 'Tools' collection of the toolbarsmanager, it will not show anywhere.
Do you want me to create a sample for you or to review some sample of your and modify it?
Please let me know, I will be waiting for your feedback.
here is the code, i created a sample code which behaves the same as the one i posted above. requires vs2010 c#.
Thank you a lot for the project!
It seems that the tools are not getting added to the toolbar, so you could add the following line at the end:
utm.Toolbars[0].Tools.AddTool(buttontool.Key);
So the code will now look like:
.....
Appearance1.Image = ImageList1.Images[Icon.ToString()];
buttontool.SharedPropsInternal.AppearancesSmall.Appearance = Appearance1;
buttontool.SharedPropsInternal.Caption = "Temp" + i.ToString();
buttontool.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
utm.Tools.Add(buttontool);
thansk u so much, its working.