Skip to content

Image and ImageSource for ComponentTool #727

Description

@itg-assistant

Felix CHAN asked 2017-03-25 07:24:28 UTC

Hi,

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 ?

Regards,

Felix CHAN

Metadata

Metadata

Assignees

No one assigned

    Labels

    GeneralQuestions, how-tos and everything else.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions