I couldn't get around your problem... So I tried something different but not getting an image...
Dim hlper As New System.Windows.Interop.WindowInteropHelper(Me)
Dim gr As System.Drawing.Graphics = System.Drawing.Graphics.FromHwnd(hlper.Handle)
Dim ms As New MemoryStream
Dim bmp As System.Drawing.Bitmap = New System.Drawing.Bitmap(gr.VisibleClipBounds.Width, gr.VisibleClipBounds.Height, gr)
Dim bImg As System.Windows.Media.Imaging.BitmapImage = New System.Windows.Media.Imaging.BitmapImage()
bImg.StreamSource = New MemoryStream(ms.ToArray())
PS: I'm running in fullscreen mode and want preview and open window thumbnails as navigational tools...
I tried sending WM_PAINT to the window but I only got the border without the content. Looks like WPF windows do not respond to WM_PAINT properly and there is no built-in method to draw non-client area. Try to get the non-client area and the client area and compose into a single bitmap. Or maybe you should look into this DWM Thumbnail Overview[^].
I tried sending WM_PAINT to the window but I only got the border without the content.
What I do know is that WPF & GDI+ work in two seperate worlds... WPF draws in DirectX space...
I'd be interested in looking at it. I've got the code to capture the elements and you've got the code to capture the non-client area. Tying the two techniques together is a near enough hack to solve my problem.
Private Const WM_PRINT As Integer = &H317
Private Const PRF_NON_CLIENT As Integer = &H2
Private Const PRF_CLIENT As Integer = &H4
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageW" (ByVal hWnd As IntPtr, _
ByVal Msg As Integer, _
ByVal wParam As Integer, _
ByVal lParam As Integer) As Integer
Public Sub DrawToBitmap(ByVal hWnd As IntPtr, ByVal bitmap As System.Drawing.Bitmap, _
ByVal targetBounds As System.Drawing.Rectangle)
If (bitmap Is Nothing) Then Throw New ArgumentNullException("bitmap")
If (((targetBounds.Width <= 0) OrElse (targetBounds.Height <= 0)) _
OrElse ((targetBounds.X < 0) OrElse (targetBounds.Y < 0))) Then _
Throw New ArgumentException("targetBounds")
Using graphics = System.Drawing.Graphics.FromImage(bitmap)
Dim hDC = graphics.GetHdc()
SendMessage(hWnd, WM_PRINT, hDC.ToInt32(), PRF_CLIENT + PRF_NON_CLIENT)
But you'll have to get the exact width and height of the window in case the window is maximized.
Althought WPF uses DirectX, I think they could have made WM_Print work by composing the client and non-client bitmaps the same way you would do with the code.
Are there any issues with using a WPF Browser Application with WCF as I was reading something about issues with WSDualHttpBinding. If this is the case is the best way around it to have use BasicHttpBinding or WSHttpBinding and don't use callbacks.
Cheers for your view / help with this.
Some people are like slinky's... They're not really good for anything but they bring a smile to your face when pushed down the stairs
Hello guys! I need to have different context menus in my datagrid - one for its header and one for rows of a grid. So I'm handling MouseClick event and than I need to evaluate if the underlying object for mouse cursor is Datagrid's header. Can you explain me how can I make this? The thing that I can't understand is that neither of DataGrid's and DataGridColumn's hierarchy of objects contain DataGridColumnHeader object or any reference to it. But in virtual tree if I get textblock that is located in header and contains column header's text and then get it parent container, I'll get DatagridColumnHeader object.
You might have better luck getting a good answer over on the codeplex forum.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
I want to create a listbox or listview displaying various furniture parts such as "table leg" or "table top", and then I want to be able to click on these items, and then drag them onto a viewport, but soon as my mouse pointer enters the viewport, the application should generate a 3D model of a table leg or table top, and fix the model in place as soon as I release the mouse button. Similar to how MS Visio works.
Would this be possible? Any help will be appreciated!
Alrightie. As much as I hate WPF's unreasonable adoption for your typical desktop application, I actually want to write an app that has a viable need for WPF. Specifically, I'll be trying to implement some control animation and displaying graphics. To give you an idea of what I want to accomplish, check out Media Portal[^]. It has fancy control animation and displays graphics. My app will be a movie database of movies I own, and I want the interface to resemble the one used in Media Portal. I'm not necessarily interested in interfacing with Media Portal, I just want it to look kinda the same.
Any advice on where to start would be greatly appreciated.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
There is a sample application called photosuru photosuru for cataloging photos, it's interface is pretty good although its not like mediaportal/mediacenter. It is based around rss subscriptions instead of local storage but you may want to check out the source anyway.
I've looked for an app to do what you described but haven't found one I like. I also began writing one but lost interest. You way want to look at some existing ones for ideas perhaps Delicious Library (Mac) and Revolución (Java, not out yet).
I haven't used any of those composite application libraries perhaps someone else could recommend them if they're appropriate for this type of app?