简体   繁体   中英

set tooltip for a control inside dataRepeater

I have a pictureBox inside a Winforms DataRepeater for which I want to set the tooltip, I tried

ToolTip tt = new ToolTip();
tt.SetToolTip(dataRepeater1.ItemTemplate.Controls["picDeleteEntry"]
                                                       ,"Delete This Entry");

I also tried

tt.SetToolTip(picDeleteEntry, "Delete This Entry");

still its not showing tooltip.

How to solve?

Finally I arrived at a solution, but let me know if any still better solution is available

my idea is like this:

in mouseHover event of the PictureBox inside DataRepeater, set the tooltip like this

if (tt.GetToolTip((PictureBox)sender)==string.Empty)
    tt.SetToolTip((PictureBox)sender, "Delete This Entry");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM