Windows 8 x64 Rus
AutoCAD 2013 SP1.1 Enu
***
When I open WPF Window in AutoCAD, I can't set location for it, because AutoCAD
ignores my settings of location. Why it happens? How can I solve it problem?
...
using WinForms = System.Windows.Forms;
using wpf = System.Windows;
using acad = Autodesk.AutoCAD.ApplicationServices.Application;
using AcWin = Autodesk.AutoCAD.Windows;
...
const Int32 offset = 10;
...
// Create new WPF window for using its as context menu
wpf
.Window win
= new wpf
.Window(); wpf
.Controls.StackPanel sp
= new wpf
.Controls.StackPanel(); win.Content = sp;
wpf
.Controls.MenuItem _clear
= new wpf
.Controls.MenuItem();_clear.Header = "Clear result";
_clear.Click += mi_Click;
sp.Children.Add(_clear);
wpf
.Controls.MenuItem _report
= new wpf
.Controls.MenuItem(); _report.Header = "Show Report";
sp.Children.Add(_report);
win.SizeToContent = wpf.SizeToContent.WidthAndHeight;
win.WindowStyle = wpf.WindowStyle.None;
win.ResizeMode = wpf.ResizeMode.NoResize;
win.WindowStartupLocation = wpf.WindowStartupLocation.Manual;
// Below are located the both methods for location of Window,
// but they ain't working:
// 1. I have tried such method:
win.Left = wpf.SystemParameters.FullPrimaryScreenWidth - 30;
win.Top = wpf.SystemParameters.FullPrimaryScreenHeight - 30;
// 2. And I have tried such method:
// win.Left = System.Windows.Forms.Cursor.Position.X + offset;
// win.Top = System.Windows.Forms.Cursor.Position.Y + offset;
win.Deactivated += win_Deactivated;
acad.ShowModelessWindow(win); // Open WPF window
Through WPF Window using I try solve
this problem: when the events not happens for MenuItem.Click. Through WPF Window I solved its problem, but I got other problem - with Window's location...