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

DocumentTabStrip Close Button hovered image

1 Answer 136 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Ian
Top achievements
Rank 1
Ian asked on 13 Dec 2011, 09:25 PM
Hi Telerik

I want to replace the image displayed when ShowCloseButton is active on a document tabstripitem while maintaining its hover and pressed image behaviour.

I create the dodument window at run time and I can get the image to change to a static image using the following line

            document.TabStripItem.CloseButton.Image = Resources.GreenTickNormal22;

where "document" is typeof(DocumentWindow)

I also have added the following lines to get the image to change but these lines don't seem to be working

            document.TabStripItem.CloseButton.ImageHovered = Resources.GreenTickHover22;;
            document.TabStripItem.CloseButton.ImageClicked = Resources.GreenTickClick22;

Am I missing and event somewhere which needs to be raised?

Regards
Ian Carson

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 16 Dec 2011, 05:49 PM
Hi Ian,

Thank you for writing.

Indeed, there seems to be an issue with the ImageHovered and ImageClciked properties of RadImageButtonElement. I have logged this issue into our PITS system and we will address it in a future release. Here is a link to the item, where you can add your vote for it. 

Meanwhile, you can use the following approach to achieve the desired appearance:
Image saveOriginalImage;
private void radButton1_Click(object sender, EventArgs e)
{
    DocumentWindow document = new DocumentWindow();
    radDock1.AddDocument(document);
    saveOriginalImage = document.TabStripItem.CloseButton.Image;
    document.TabStripItem.ShowCloseButton = true;
    document.TabStripItem.CloseButton.Image = Resources.help;
 
    document.TabStripItem.CloseButton.MouseMove += new MouseEventHandler(CloseButton_MouseMove);
    document.TabStripItem.CloseButton.MouseLeave += new EventHandler(CloseButton_MouseLeave);
 
  //  document.TabStripItem.CloseButton.ImageHovered = saveOriginalImage;
  //  document.TabStripItem.CloseButton.ImageClicked = saveOriginalImage;
}
 
void CloseButton_MouseMove(object sender, MouseEventArgs e)
{
    RadImageButtonElement b = sender as RadImageButtonElement;
    b.Image = saveOriginalImage;
}
 
void CloseButton_MouseLeave(object sender, EventArgs e)
{
    RadImageButtonElement b = sender as RadImageButtonElement;
    b.Image = Resources.help;       
}

I hope that you find this information helpful. Should you have any other questions or suggestions, do not hesitate to contact us.

Kind regards,
Stefan
the Telerik teamQ3’11 of RadControls for WinForms is available for download (see what's new). Get it today.
Tags
Dock
Asked by
Ian
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or