Note that there are some explanatory texts on larger screens.

plurals
  1. POCreating Scratch card effect on Windows Phone c# xaml
    primarykey
    data
    text
    <p>I would like to create a scratch card effect on the Windows Phone. However my current solution seem sluggish and the scratch effect look weird(refer to the screenshot below). The experience is very poor as compared to those that i had seen on iOS.</p> <p><img src="https://i.stack.imgur.com/hzsoe.jpg" alt="enter image description here"></p> <p>Would appreciate if someone could guide me toward it. Below are my current code.</p> <pre><code> &lt;Grid Width="Auto" Height="Auto" Background="Black"&gt; &lt;Viewbox Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center"&gt; &lt;Grid Height="60" Width="60" Background="White"&gt; &lt;InkPresenter x:Name="inkP" Width="60" Height="60"&gt; &lt;InkPresenter.Background&gt; &lt;ImageBrush Stretch="Fill" ImageSource="/Assets/image.png"/&gt; &lt;/InkPresenter.Background&gt; &lt;Grid Height="60" Width="60"&gt; &lt;TextBlock x:Name="lblsecretText" HorizontalAlignment="Center" TextWrapping="Wrap" Text="LOL" VerticalAlignment="Center" Width="60" Foreground="Black" TextAlignment="Center" FontSize="5.333"/&gt; &lt;/Grid&gt; &lt;/InkPresenter&gt; &lt;/Grid&gt; &lt;/Viewbox&gt; &lt;/Grid&gt; Stroke s; int mycol = 0; public MainPage() { InitializeComponent(); inkP.MouseMove += new MouseEventHandler(inkP_MouseMove); for (int i = 0; i &lt; 60; i++) { for (int l = 0; l &lt; 60; l++) { Stroke bigStroke = new Stroke(); bigStroke.StylusPoints.Add(new StylusPoint(i, l)); inkP.Strokes.Add(bigStroke); } } } StylusPoint _lastPoint; void inkP_MouseMove(object sender, MouseEventArgs e) { StylusPointCollection pointErasePoints = e.StylusDevice.GetStylusPoints(inkP); pointErasePoints.Insert(0, new StylusPoint(e.GetPosition(inkP).X, e.GetPosition(inkP).Y)); //Compare collected stylus points with the ink presenter strokes and store the intersecting strokes. StrokeCollection hitStrokes = inkP.Strokes.HitTest(pointErasePoints); if (hitStrokes.Count &gt; 0) { foreach (Stroke hitStroke in hitStrokes) { inkP.Strokes.Remove(hitStroke); } } _lastPoint = pointErasePoints[pointErasePoints.Count - 1]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload