Entireweb

Free Search Engine Submission

Konga Deals

Saturday 28 March 2015

Docking a WPF window inside AutoCAD – Part 2


I’m happy to say that the implementation I mentioned in the last post ended up being pretty straightforward. Which is actually great, as I have some important posts to work on for next week. :-)
Today we’re going to take a look at the next stage of the “command-line helper” implementation: basic right-click movement of the global keywords dialog, so we can set a custom location for the dialog without needing to use the KWSDOCK command.
Here’s the code in action:

CmdLineHelper with right-click dialog move
The main work for this stage was to add support for right-click, mouse move and right mouse-button up events, making sure that the dialog is displaced accurately irrespective of where the mouse gets moved. And that’s actually a really nice feature of this version: you can move the dialog off the main AutoCAD window, if you want to (this wasn’t supported in the KWSDOCK command as we’re using Editor.GetPoint() to let the user select custom locations).

I’ve turned off the mouse cursor in the above video, but you would see a “all-direction scrolling” cursor: the pan cursor isn’t a standard one in Windows, so I just used something that was good enough for this particular app.
There were some other minor things to work through, but hopefully the C# code in this version of the project is straightforward to understand.
In the next part in this series we’re going to extend this implementation to support docking – and preview of dock locations – when you right-click drag the dialog close to corners of the drawing window.

No comments:

Post a Comment

Level 99 Denim

Level 99 Denim