我做了一个您试试
- public override Control PaintCell(string id, TableCell parent, Appearance style, Inset margin, object value, bool upperLevel)
- {
- // parent.Attributes.Add("title", this.Message);
- parent.Attributes.Add("data-message", this.Message);
- parent.Attributes.Add("onmouseover", "mouseOver(this,event)");
- parent.Attributes.Add("onmouseout", "mouseOut(this,event)");
-
- return base.PaintCell(id, parent, style, margin, value, upperLevel);
- }
复制代码
- <script>
- var _toolTipElement;
- function mouseOver(sender, event) {
- if (!_toolTipElement) {
- var div = document.createElement("div");
- $(div).css("position", "absolute")
- .css("border", "1px #C0C0C0 solid")
- .css("box-shadow", "1px 2px 5px rgba(0,0,0,0.4)")
- .css("font", "9pt Arial")
- .css("background", "yellow")
- .css("padding", 5)
- .css("top", event.clientY)
- .css("left", event.clientX);
- _toolTipElement = div;
- }
- $(_toolTipElement).text($(sender).data("message"));
- $(_toolTipElement).hide();
- document.body.insertBefore(_toolTipElement, null);
- $(_toolTipElement).show("fast");
- }
- function mouseOut(sender, event) {
- if (_toolTipElement) {
- document.body.removeChild(_toolTipElement);
- _toolTipElement = null;
- }
- }
- </script>
复制代码 |