![]() |
|
|
|
#1
|
|||
|
|||
|
Actually I couldn't get vizard to respond to a resize. So I started searching for automatically resizing a hosted window and found a separate solution: involve winforms. Adapting this, I was able to get what I needed. Many thanks for pointing me in the right direction.
It now resizes, responds to input, etc etc. This method is reliant on the main window handle of the vizard process, so I regrettably can't support the console in my nicely encapsulated vizard control. It has to wait for vizard to start up the main form, so there's a quick flash of vizard's graphics window out of place. So to anyone looking to embed a win32 application in a WPF control, I'd say just use winforms. and I guess to answer my own original question, "nope." Last edited by Adam.Grey; 06-28-2012 at 08:38 AM. |
|
#2
|
|||
|
|||
|
I'm not sure this will work, but another method is to reparent the Vizard graphics window to the WPF window, instead of reusing the WPF window handle. This is what the Vizard Script -> Run Docked command does, and input messages still work properly.
Let the Vizard script create its own window as usual, but parent it to the handle passed to the command line: Code:
viz.go()
import win32gui
import win32con
if(len(sys.argv) > 1):
viz.window.setBorder(viz.BORDER_NONE)
viz.window.setPosition([0,0])
hwndChild = viz.window.getHandle()
hwndParent = int(sys.argv[1])
style = win32gui.GetWindowLong(hwndChild,win32con.GWL_STYLE)
style = style | win32con.WS_CHILD
style = style & ~(win32con.WS_OVERLAPPEDWINDOW | win32con.WS_POPUP)
win32gui.SetWindowLong(hwndChild,win32con.GWL_STYLE,style)
win32gui.SetParent(hwndChild ,hwndParent)
|
![]() |
| Tags |
| <viz>.go, csharp, embed, win32, wpf |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| recording screen in vizard when embedded in wxpython | Renato Lima | Vizard | 0 | 11-21-2011 02:10 PM |
| Vizard 4 Beta Testing | farshizzo | Announcements | 0 | 02-01-2011 11:46 AM |
| Vizard 4 Beta Testing | farshizzo | Vizard | 0 | 02-01-2011 11:46 AM |
| Vizard tech tip: Using the Python Imaging Library (PIL) | Jeff | Vizard | 0 | 03-23-2009 12:13 PM |
| embedded Vizard | tavaksai | Vizard | 5 | 12-21-2004 08:49 AM |