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);
}
}

 

posted @   南胜NanSheng  阅读(314)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· AI 智能体引爆开源社区「GitHub 热点速览」
· 写一个简单的SQL生成工具
点击右上角即可分享
微信分享提示