Windows Vista Forums
Vista Forums Home Join Vista Forums Webcasts Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

Crazy question - is there any way to extract the display of a windowinto an image file?

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 01-10-2006   #1 (permalink)
Jason Dolinger
Guest


 

Crazy question - is there any way to extract the display of a windowinto an image file?

Just like the subject says. I've got this idea for extracting an image
(.bmp, .jpg, .pnf, whatever) that looks like the display of a window and
putting it at the content of a WPF button. Does anyone know of a
possible way to do that? I was hoping I could actually nest the window
directly as the button content, but that ends up with the following
runtime exception:

{"Window must be the root of the tree. Cannot add window as a Logical or
Visual child of any Visual."}


Thanks!
Jason

My System SpecsSystem Spec
Old 01-10-2006   #2 (permalink)
Douglas Stockwell
Guest


 

Re: Crazy question - is there any way to extract the display of a window into an image file?

I think you are looking for VisualBrush. Unfortunately, if you try to reference
a visual earlier in the tree you end up in an infinite loop. It doesn't look
like you will be able to use this to get an image of the entire window. Depending
on your exact scenario this simple example may help:

<Window x:Class="WindowsApplication.Window1"
xmlns="http://schemas.microsoft.com/winfx/avalon/2005"
xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005">
<DockPanel>
<StackPanel Name="MainWindow">
<Button>Button 1</Button>
<Button>Button 2</Button>
<Button>Button 3</Button>
</StackPanel>
<Button>
<Rectangle Width="300" Height="300">
<Rectangle.Fill>
<VisualBrush Visual="{Binding ElementName=MainWindow}" />
</Rectangle.Fill>
</Rectangle>
</Button>
</DockPanel>
</Window>

> Just like the subject says. I've got this idea for extracting an
> image (.bmp, .jpg, .pnf, whatever) that looks like the display of a
> window and putting it at the content of a WPF button. Does anyone
> know of a possible way to do that? I was hoping I could actually nest
> the window directly as the button content, but that ends up with the
> following runtime exception:
>
> {"Window must be the root of the tree. Cannot add window as a Logical
> or Visual child of any Visual."}
>
> Thanks!
> Jason



My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Ildasm.exe to extract an image in a PictureBox Mezz .NET General 0 03-21-2008 12:49 PM
the display goes crazy DJ_danne Vista hardware & devices 4 06-08-2007 06:14 PM
Extract a zip file Christian Vista security 2 05-28-2007 05:21 PM
funny image making my vista go crazy Maciej Sołtysiak Vista General 3 05-22-2007 09:30 AM
HP Compaq NX7000 display goes crazy after install =?Utf-8?B?UmljaA==?= Vista hardware & devices 0 09-06-2006 08:40 PM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51