Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text Box which Blends into background

How do I create a Text Box which Blends into the background page, the idea here is i want to create NoteBook like Effect with lines and user types on lines ( just like writing in Notebook with lines).

like image 815
Ashwin Nagarajan Avatar asked Jun 06 '12 12:06

Ashwin Nagarajan


2 Answers

Take a TextBox with transparent background, put it on top of your notebook paper image and align font size so it looks as desired. You may want to wrap TextBox with ViewBox

 <TextBox TextWrapping="Wrap" Background="{x:Null}"/>

Or use a TextBox with notebook paper image as background:

 <TextBox TextWrapping="Wrap">
    <TextBox.Background>
       <ImageBrush ImageSource="notebook-paper.png"/>
    </TextBox.Background>
 </TextBox>
like image 69
StaWho Avatar answered Sep 29 '22 22:09

StaWho


Style your TextBox as required so that the background shows through. To remove the Textbox's background, padding, border, etc., use:

<TextBox Margin="0" BorderThickness="0" Padding="0" Background="Transparent" />

To control the line height so that it lines up neatly on your notepad line graphic, use the TextBlock attached properties:

<TextBox
    Margin="0" BorderThickness="0" Padding="0" Background="Transparent"
    TextBlock.LineHeight="10" 
    TextBlock.LineStackingStrategy="BlockLineHeight" />
like image 23
Ross Avatar answered Sep 29 '22 20:09

Ross