WPF Memo 1 (related image painter)

Source: Internet
Author: User

1. Image brushes

Imagebrush: Specify the imagesource. If you consider the effect, you can use it together with the viewport and tilemode attributes to improve the effect.

<Textbox width = "200" Height = "20" text = "WPF learning summary"> <textbox. foreground> <imagebrush imagesource = "ticket.png" viewport = "0.3, 0.3," tilemode = "tile"> </imagebrush> </textbox. foreground> </textbox>

2. Linear Gradient painting brush

Lineargradientbrush: Specifies the startpoint and Endpoint attributes, and uses the color and offset attributes of gradientstop to specify different colors and the starting offset respectively.

<Rectangle Width="100" Height="100">    <Rectangle.Fill>          <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">                  <GradientStop Color="Black" Offset="0"></GradientStop>                  <GradientStop Color="White" Offset="1"></GradientStop>           </LinearGradientBrush>     </Rectangle.Fill> </Rectangle>

3. Radiation gradient Paint Brush

Radialgradientbrush uses the gradientorigin attribute to specify the position of the Radiation Center, and uses the color and offset attributes of gradientstop to specify different colors and start offsets respectively.

<Ellipse Width="100" Height="100">     <Ellipse.Fill>            <RadialGradientBrush GradientOrigin="0.8,0.9">                   <GradientStop Color="Black" Offset="0"></GradientStop>                   <GradientStop Color="White" Offset="1"></GradientStop>            </RadialGradientBrush>      </Ellipse.Fill> </Ellipse>

4. Visual painter

Visualbrush, which specifies the visual attributes and can be used with transform to produce the reflection effect.

<TextBox Width="100" Height="50" x:Name="textBox1" Margin="12,12,391,249"></TextBox><Rectangle Height="50" HorizontalAlignment="Left" Margin="9,73,0,0" StrokeThickness="0" Name="rectangle1" Stroke="Black" VerticalAlignment="Top" Width="105">     <Rectangle.Fill>            <VisualBrush Visual="{Binding ElementName=textBox1}">                  <VisualBrush.RelativeTransform>                      <TransformGroup>                          <ScaleTransform ScaleX="1" ScaleY="-1"></ScaleTransform>                          <TranslateTransform Y="1"></TranslateTransform>                     </TransformGroup>                </VisualBrush.RelativeTransform>          </VisualBrush>    </Rectangle.Fill></Rectangle>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.