Question

I'm working on a project with the kinect (I'm adding in case someone has a good way to do using the kinect) but I think this is mostly some programming issue in C# and WPF. I want to make to have 2 pictures, one on top of the other and with a mouse click, be able to scratch the first picture out. I tried using inkcanvas and put the picture in the inkcanvas but I can only draw on top of it.

Can someone give me an idea or some methods he think it would be better way to proceed?

Était-ce utile?

La solution

An idea might be using an OpacityMask which is a VisualBrush that contains your InkCanvas.

Autres conseils

This is what I did, Thanks @HB for your help. part of the code comes from http://geekswithblogs.net/tkokke/archive/2009/03/02/scratchcard-in-wpf.aspx if anyone wants to know or need it.

<Border Background="#FF909090" BorderBrush="#FF000000" 
     BorderThickness="2,2,2,2">
        <Grid Width="Auto" Height="Auto">
            <Grid.Background>
               <ImageBrush ImageSource="birthday_cake_by_protoperahe.jpg"/>
            </Grid.Background>
            <InkCanvas x:Name="inkCanvas" 
                Background="{x:Null}">
                <InkCanvas.DefaultDrawingAttributes>
                    <DrawingAttributes Height="25" Width="25"/>
                </InkCanvas.DefaultDrawingAttributes>
            </InkCanvas>
            <Image IsHitTestVisible="False" Source="planet.jpg" Stretch="Fill">
                <Image.OpacityMask>
                    <VisualBrush 
                 Visual="{Binding ElementName=inkCanvas}"/>
                </Image.OpacityMask>
            </Image>

        </Grid>

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top