Wajeed Shaikh
Wajeed Shaikh

Reputation: 3158

Highlighter InkCanvas

I have used IsHighlighter property of InkCanvas to create highlighter tool . In real life when we use highlighter it highlights on the top of our notebooks or books writing , but in InkCanvas i am not able to highlight on the top of Ink which i have previously drawn . I am creating application which have pen as well highlighter tool , now if i have to highlight some thing which i have drawin onto InkCanvas using pen highliter goes down to Ink .

Check this image, in which i have pen as well highlighter

here highlighter is highlighting bellow my pen's drawing.

Any solutions?

Upvotes: 0

Views: 1268

Answers (1)

Emond
Emond

Reputation: 50672

If you want to manipulate the ZOrder of strokes there is a workaround for that: Using multiple InkCanvases

I am a bit disappointed by this; I'd expect the ability to move strokes on top. I even tried to manipulate the order of the Strokes in the StrokeCollection but to no avail.

So I found a more intuitive way: just do not use the IsHighlighter property but instead make a DrawingAttributes object with a Transparent color:

private DrawingAttributes _highLighter =
    new DrawingAttributes { 
        Color = Color.FromArgb(128, 255, 255, 0),
        IsHighlighter = false, 
        Width = 20, Height = 20 
    };

The strokes with this color will be added on top just like a normal highlighter and when you switch back to a pen(cil) you will overwrite the highlights, just as in real life.

Upvotes: 1

Related Questions