AVEVA MARINE C# 鼠标悬停
先看效果:
一些效果
https://www.bilibili.com/video/BV1294y1w7Lm/?vd_source=0b221dbd75584a13ab6cd4551f3a0ec2
需要用到的dll
C:\AVEVA\Marine\OH12.1.SP4\ExplorerControl.dll
C:\AVEVA\Marine\OH12.1.SP4\Infragistics.Win.dll
C:\AVEVA\Marine\OH12.1.SP4\Infragistics.Win.UltraWinTree.dll
完整的代码
[MyAmFunctionAtt(nameof(测试功能), nameof(显示toolTip的内容))] public static void 显示toolTip的内容(WindowManager wm) { try { var de = wm.Windows.Cast<IWindow>().FirstOrDefault(c => c.Title == "Design Explorer") as DockedWindow; var ut = de.Control.Controls[0] as Infragistics.Win.UltraWinTree.UltraTree; //de.Tooltip = ""; if (ut != null) { //UltraToolTipManager uttm = new UltraToolTipManager(); var tt = new Infragistics.Win.ToolTip(ut) { AutoPopDelay = 8000, InitialDelay = 1000, BorderStyle = Infragistics.Win.ToolTipBorderStyle.Solid, DisplayStyle = Infragistics.Win.ToolTipDisplayStyle.BalloonTip, ForeColor = System.Drawing.Color.Blue, BackColor = System.Drawing.Color.LightYellow, //tt.DisplayStyleResolved = Infragistics.Win.ToolTipDisplayStyle.WindowsVista; CustomToolTipImage = Properties.Resources.logo, ToolTipTitle = "增强属性", //tt.ToolTipTextStyle = Infragistics.Win.ToolTipTextStyle.Formatted; TopMost = true, }; ut.MouseEnterElement += (s, e) => { try { var pos = ut.PointToClient(System.Windows.Forms.Control.MousePosition); var anode = ut.GetNodeFromPoint(pos); if (anode == null) return; var etd = anode as ExplorerTreeNode; if (etd == null) return; //tt.UseAppStyling = true; var ele = etd?.Element; StringBuilder sb = new StringBuilder(); sb.AppendLine($"Description:{ele.GetActualType().Description}"); sb.AppendLine($"RefNo:{ele.GetAsString(DbAttributeInstance.REF)}"); sb.AppendLine($"Name:{ele.GetAsString(DbAttributeInstance.NAMETY)}"); sb.AppendLine($"CLMID:{ele.GetAsString(DbAttributeInstance.CLMID)}"); sb.AppendLine($"UserLastMod:{ele.GetAsString(DbAttributeInstance.USERM)}"); sb.AppendLine($"Userclaim:{ele.GetAsString(DbAttributeInstance.USERC)}"); sb.AppendLine($"DateLastMod:{ele.GetAsString(DbAttributeInstance.LASTM)}"); tt.ToolTipText = sb.ToString(); tt.Show(); } catch (Exception ex) { Interaction.MsgBox(ex.Message, MsgBoxStyle.Critical); } }; ut.MouseLeaveElement += (s, e) => { tt.Hide(); }; } } catch (System.Exception ex) { Interaction.MsgBox(ex.Message, MsgBoxStyle.Exclamation); } }
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· winform 绘制太阳,地球,月球 运作规律
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· AI 智能体引爆开源社区「GitHub 热点速览」
· 写一个简单的SQL生成工具