Quantcast
Channel: C#タグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 8901

Autodesk Inventor API Hacking (Modeless FormのZ order)

$
0
0

0. はじめに

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

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

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

varmyDialog=newMyDialog();varowner=newSystem.Windows.Forms.NativeWindow();owner.AssignHandle((System.IntPtr)InventorApplication.MainFrameHWND);myDialog.Show(owner);

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

99. 親の記事に戻る

Autodesk Inventor API Hacking (概略)


Viewing all articles
Browse latest Browse all 8901

Trending Articles