Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: C# WPF HWND problems  (Read 586 times)
adeebm
Community Member
*
Posts: 21


« on: July 15, 2008, 03:26:31 PM »

I've been using truevision in winforms for a while and just made the switch to wpf. Everything works except rendering. Because truevision requires a handle to render I used a hack to extract the handle from the wpf windows. The problem is, because of wpf's rendering technique thing rendered to the handle go on top so all my controls are covered. Controls in wpf don't have handles so I cant render to an image(picturebox). I tried using interop to render to a winforms control, but because of wpf it still covers all the control(Interop control are always on top) I even tried having the winforms picturebox hidden, rendering then capturing the picture and copying to a wpf image but it comes up black. Has anyone used truevision with wpf before? Maybe if i knew how truevision rendered to the HWND i could get the image. or is there a way for truevision to render to a bitmap or something?

--Adeeb
Logged
adeebm
Community Member
*
Posts: 21


« Reply #1 on: July 17, 2008, 01:43:00 PM »

Anyone? It kind of urgent...
Logged
Raine
Customers
Community Member
*****
Posts: 1152


« Reply #2 on: July 18, 2008, 04:54:36 PM »

I think you'll get far more results over at codeproject.com, I'm sure one of the WPF gurus has your solution...
Logged

adeebm
Community Member
*
Posts: 21


« Reply #3 on: July 19, 2008, 02:06:02 PM »

I posted here because I'm wondering if truevision has another way to render, like to a bitmap?
Logged
kcs_aug
Community Member
*
Posts: 2


« Reply #4 on: September 05, 2008, 02:00:03 PM »

new on the site...
you can use 
<WindowsFormsHost Canvas.Left="10" Canvas.Top="75" Height="450"
                          Name="whPanel" Width="326" Visibility="Visible" />
this will Host Windows Forms controls...ie. winfoms picbox..

  Dim xpanel As New PictureBox
    Dim host2 As New WindowsFormsHost()

        xpanel.Width = gWidth
        xpanel.Height = gHeight
        xpanel.BackColor = Color.Black
        host2.Child = xpanel
        whPanel.Child = host2.Child

        now the Render Window is a WinForms Picture Box...

I have tested 'other' 3d sdks in it.. works.. am going to try
TV3d now.. good luck..
Logged
kcs_aug
Community Member
*
Posts: 2


« Reply #5 on: September 05, 2008, 02:06:23 PM »

forgot to mention in above.. you probably realize..
since the host is now a winforms picture box it HAS a handle.. just use
it like a non WPF control.. because it is.. therefore , I assume,  any and all
WPF AND WinForms controls can be used in a WPF application....
Logged
DP-John
Customers
Community Member
*****
Posts: 120


« Reply #6 on: September 26, 2008, 07:49:12 PM »

The proper way to do this is to reference System.Runtime.InteropServices

In VB.Net it goes like this...

Code:
Dim mainWindowPtr As Integer = New WindowInteropHelper(Me).Handle

This returns the window reference (hwnd) of a WPF window.
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks