大概思路如下:
- private void Form1_Load(object sender, EventArgs e)
- {
- SectionReport1 rpt = new SectionReport1();
- rpt.Run();
- viewer1.Document = rpt.Document;
-
- viewer1.Toolbar.ToolStrip.Items[2].MouseEnter += new EventHandler(ToolStrip_MouseEnter);
- viewer1.Toolbar.ToolStrip.Items[2].MouseLeave += new EventHandler(ToolStrip_MouseLeave);
- }
- ToolTip toolTip = null;
- void ToolStrip_MouseLeave(object sender, EventArgs e)
- {
- viewer1.Toolbar.ToolStrip.ShowItemToolTips = true;
- Point point = viewer1.PointToScreen(System.Windows.Forms.Control.MousePosition);
- ToolStripItem item = viewer1.Toolbar.ToolStrip.GetItemAt(point);
- System.Diagnostics.Debug.WriteLine(item);
- toolTip.RemoveAll();
- }
- void ToolStrip_MouseEnter(object sender, EventArgs e)
- {
- viewer1.Toolbar.ToolStrip.ShowItemToolTips = false;
- toolTip = new ToolTip();
- toolTip.SetToolTip(viewer1, "打印");
- toolTip.Show("打印", viewer1.Toolbar.ToolStrip);
- }
复制代码 |