LoginSignup
0
0

More than 3 years have passed since last update.

Autodesk Inventor API Hacking (Modeless FormのZ order)

Posted at

0. はじめに

WinFormをModelessで表示してから(具体的にはmyForm.Show()してから)、InventorのWindowをclickすると、FormがInventorの背後に隠れます。
Z orderを指定するにはどうするのか、という話しです。

1. Inventorより前面にくるように指定する方法

通常のWinFormのApplicationですと、Showの引数に親Formを指定すれば、親の背後に回ることはありません。
Inventorの場合は、親がWinFormではないので、次のようにします。

var myDialog = new MyDialog();

var owner = new System.Windows.Forms.NativeWindow();
owner.AssignHandle((System.IntPtr)InventorApplication.MainFrameHWND);

myDialog.Show(owner);

この場面以外でも、凝ったことをしようとするとwin32 APIを直接たたく必要に迫られることがありますが、Application.MainFrameHWNDでWindow Handleが得られるのは知っておいて損がないです。

99. 親の記事に戻る

Autodesk Inventor API Hacking (概略)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0