WPF text box
In fact, we went on to talk about the last lesson.
Drag a textbox to the form, and draw a picture on the background color of the word.
<Textbox margin = "0, 52, 16, 69" name = "textbox1" fontsize = "36"
Background = "yellow" borderbrush = "red" borderthickness = "7"
Fontfamily = "Arial bold">
<Textbox. Foreground>
<Imagebrush imagesource = "rose.bmp"/>
</Textbox. Foreground>
</Textbox>
For better results, we set the font to Arial bold.
Because of the image, the effect is not very good.
Next we will give it two text boxes for reflection.
The square above.
<Rectangle margin =" 5, 7, 16, 0 "Name =" Rectangle1 "Stroke =" Black "Height =" 42 "Verticalalignment =" Top "Strokethickness =" 0.01 "> <Rectangle. Fill> <visualbrush visual =" {Binding elementname = textbox1} "> <Visualbrush. relativetransform> <transformgroup> <scaletransform scalex =" 1 "Scaley =" -1 "/> <Translatetransform y =" 1 "/> </Transformgroup> </visualbrush. relativetransform> </visualbrush> </rectangle. Fill> </rectangle>
The following square.
<Rectangle margin =" 5, 0, 16, 25 "Name =" Rectangle2 "Stroke =" Black "Strokethickness =" 0.1 "Height =" 41 "Verticalalignment =" Bottom "> <Rectangle. Fill> <visualbrush visual =" {Binding elementname = textbox1} "> <Visualbrush. relativetransform> <transformgroup> <scaletransform scalex =" 1 "Scaley =" -1 "/> <Translatetransform y =" 1 "/> </Transformgroup> </visualbrush. relativetransform> </visualbrush> </rectangle. Fill> </rectangle>
HereCodeThis is what we talked about in the previous lesson.
You can see the effect through implicit conventions.
If we put the three in a grid, it is equivalent to encapsulating the three squares.
<Rectangle horizontalalignment ="Right"Margin ="0, 26, 0, 39"Name ="Rectangle3"Stroke ="Black"Width ="184"> <Rectangle. Fill> <visualbrush visual ="{Binding elementname = grid1}"/> </Rectangle. Fill> </rectangle>
Here we bind it to the grid with three original squares.
The one on the right is a bound giant block.
End.