George Kierstein
Posts: 47
Joined: 2013-05-04
|
Hi,
I have created a Form which I open when a toolbar button is clicked. This works fine but I would like it to be a Modal dialog that is tied to the open tab and positioned in the upper left corner of the page.
I have seen a few places on the web that suggest that you have to do some manuvering with the HWND of the browser - What do you suggest a good solution would be ?
Thanks
G |
|
Andrei Smolin
Add-in Express team
Posts: 18562
Joined: 2006-05-11
|
Hello George,
Please search the string "MyWinApiWindow" in the manual. In the code samples that the manual provides, this class is used to specify the parent window for a messagebox.
In your case, you need to show the modal form using this overload:
DialogResult Form.ShowDialog(IWin32Window owner);
You can pass new MyWinApiWindow(this.ParentHandle) as the owner parameter.
Hope this helps.
Andrei Smolin
Add-in Express Team Leader |
|
George Kierstein
Posts: 47
Joined: 2013-05-04
|
Thanks,
That does make it Modal which is great. How would I use this to specify an alignment with the parent window - it always opens in the same location which isn't related to the window and the default options are only to center it.
Ideally what I'd like is to be able to retrieve the bounds of the the actual page area (or the browser itself) so that the form is aligned to the top right of the page instead of floating off to the side or forcibly centered.
Is that possible ? If not, how can I pull out the bounds of the open IE window from its parent handle ?
THanks
G |
|
Andrei Smolin
Add-in Express team
Posts: 18562
Joined: 2006-05-11
|
George,
Try setting Form.Location in the Form.Shown event of the form. You can use GetWindowRect WinAPI function to get coordinates of the IE window identified by its hwnd.
Andrei Smolin
Add-in Express Team Leader |
|