I have been attempting to follow this AutoCAD DEVBlog article on formatting rollover tooltips and I am running into issues. Below is the exact code that I am using. I have referenced accoremgd, acmgd, and acdbmgd.
using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.EditorInput; using Autodesk.AutoCAD.Runtime; namespace ToolTipFormatting { public class Class1 : IExtensionApplication { void IExtensionApplication.Initialize() { Document activeDoc = Application.DocumentManager.MdiActiveDocument; activeDoc.Editor.PointMonitor += new PointMonitorEventHandler(Editor_PointMonitor); } void Editor_PointMonitor(object sender, PointMonitorEventArgs e) { if (e.Context.GetPickedEntities().Length > 0) { e.AppendToolTipText("Iam]]><LineBreak/><Bold>BOLD</Bold><LineBreak/>" + "<![CDATA[Iam]]><LineBreak/><Italic>Italic</Italic>" + "<LineBreak/><![CDATA[Iam Normal"); } } void IExtensionApplication.Terminate() { Document activeDoc = Application.DocumentManager.MdiActiveDocument; if (activeDoc != null) { activeDoc.Editor.PointMonitor -= new PointMonitorEventHandler(Editor_PointMonitor); } } } }
When i try this code in straight vanila AutoCAD that is started from a desktop shortcut it works fine. If i start AutoCAD MEP or AutoCAD Architecture it fails and instead of displaying the tooltip it displays the text string inside of the e.appendtooltiptext method, If i start AutoCAD MEP and switch to the AutoCAD profile it will not work. So it seems to me that something that is loaded when MEP and ACA is loaded is keeping the tooltip from formatting correctly. Has anyone else ran into this? Does anyone know of a workaround to fix this? Hopefully it is just a format change to the text string.
Thanks!
Solved! Go to Solution.
Solved by Keith.Brown. Go to Solution.
Solved by Balaji_Ram. Go to Solution.
Hi Keith,
I have seen this behavior earlier and this is already logged as a request with our engineering team.
Sorry, I haven't found any workaround to get this working in ACA.
Regards,
I kind of thought that would be the answer. The good news is that i went ahead and monitored the tooltip opened event and when the tooltip was opened i just replaced the wpf control with my own. I actually got better results using this method. Thank you for taking the time to reply.
Was it easy to replace the WPF control? If so do you mind sharing how to do it? Civil 3D is built on ACA so I'm having the same issue showing the formatting.
Thanks!
It was actually kind of easy once the process was understood. I showed the code in a previous post which you can find at the link below.
I think that there is enough there to show everything but if you need more information let me know. Good Luck!