c# - Tooltip doesn't work with button that is set enable=false -
this question has answer here:
- how can show tooltip on disabled button? 4 answers
i render buttons on window form , there of them set enable = false. want tooltip still works every button if it's unenable. how that?
please help.
you can intercept mousemove event , display tooltip programmatically. tooltip1 form tooltip obviously
private bool tooltipshown = false; private void control_mousemove(object sender, mouseeventargs e) { var parent = sender control; if (parent == null) { return; } var ctrl = parent.getchildatpoint(e.location); if (ctrl != null) { if (ctrl.visible && tooltip1.tag == null) { if (!tooltipshown) { var tipstring = tooltip1.gettooltip(ctrl); tooltip1.show(tipstring.trim(), ctrl, ctrl.width / 2, ctrl.height / 2); tooltip1.tag = ctrl; tooltipshown = true; } } } else { ctrl = tooltip1.tag control; if (ctrl != null) { tooltip1.hide(ctrl); tooltip1.tag = null; tooltipshown = false; } } }
Comments
Post a Comment