While I am trying the ComponentTool and try adding it to a Form, I find that the image (which is a GIF) cannot be shown. I then add a Button to the form and set the Button.Image to the same image as ComponentTool. The image in the Button can be shown.
I then try to use the ImageSource property of ComponentTool , and select an image from the theme image set (e.g. “icon-refresh“). The image can be shown in the ComponentTool.
// This not work. No image is shown. // When move the mouse over the tool area of the Form, the tooltip will show. ComponentTool tool = new ComponentTool(); tool.Name = "save"; tool.ToolTipText = "Save the record"; tool.Image = Image.FromFile(path); this.Tools.Add(tool); // This will work. Image can be shown on the Button, meaning the 'path' is valid. Button button = new Button(); button.Text ="Save"; button.Image = Image.FromFile(path); this.Controls.Add(button); // And, this will also work. Image can be shown tool = new ComponentTool(); tool.Name = "refresh"; tool.ToolTipText = "Reload the record"; tool.ImageSource = "icon-refresh"; this.Tools.Add(tool);
So, why only the image from the theme can be used in ComponentTool via the property ImageSource ? It is a bug or there is some limitation on the image used by the ComponentTool ?
Please login first to submit.