Reputation: 1222
I would like to create infobox functionality in AutoCAD. Same as you hover some feature in Google Earth, it shows you infobox with picture.
I was thinking about using palette, but I'm not sure how to adjust it to looks like infobox.
I'm planning to create .NEt plugin.
Any suggestions?
Upvotes: 0
Views: 1665
Reputation: 51
Using PointMonitor, detecting if an entity of your concern being under the cursor position, and popping up your own window when applicable holding the images in a listbox, combobox or like is more controllable and flexible. The window can be WPF or WinForm of your choice.
It's definitely doable and some applications already use these techniques quite maturely. Some coordination transforming stuffs have to be taken into account, such as from window pixels to AutoCAD display system, from DCS to WCS, back and forth.
Now, the only remaining thing may be performance. Hope the following tips are of a bit help.
Upvotes: 0
Reputation: 1222
**Well, I found I think the best approach, using AutoCAD tooltip. Here is the code snippet:
Autodesk.Windows.ComponentManager.ToolTipOpened +=
(s, e) =>
{
Autodesk.Internal.Windows.ToolTip tooltip =
s as Autodesk.Internal.Windows.ToolTip;
if (tooltip != null)
{
var image = new System.Windows.Controls.Image();
var bitmapImage = new BitmapImage();
bitmapImage.BeginInit();
bitmapImage.UriSource = new Uri(@"C:/index.jpeg");
bitmapImage.EndInit();
image.Source = bitmapImage;
tooltip.Height = image.Height;
tooltip.Width = image.Width;
tooltip.Content = image;
}
};
It looks fine to me now. :)**
As I said in comment below here is the screen shot of this solution
As you can maybe note, tooltip is not positioned near geometry, I selected the pink one. That is my last problem. My flow is that when I select object, I got win form listBox that offers me several image files connected to this entity. When I choose one, it opens tootltip, but it seems relatively to listbox dialog. I was not able to find solution how to manually set tooltip position. Any suggestions?
Upvotes: 3
Reputation: 13329
You can use a PointMonitor to detect the mouse movement: http://through-the-interface.typepad.com/through_the_interface/2009/07/providing-information-on-autocad-objects-in-a-tooltip-using-net.html
And for showing an image, you can use WPF in your palette: http://through-the-interface.typepad.com/through_the_interface/2009/08/hosting-wpf-content-inside-an-autocad-palette.html
Upvotes: 2