zoukankan      html  css  js  c++  java
  • WPF:简洁为美

    (1)3行代码实现水印TextBox(Watermark  TextBox)

     效果图:


     源代码:

        <Grid>
            <Grid.Resources>
                <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
            </Grid.Resources>
            <TextBlock Text="Please enter a word" FontStyle="Italic" Foreground="LightSteelBlue" Width="200" Height="40" Visibility="{Binding ElementName=tbEntry, Path=Text.IsEmpty, Converter={StaticResource BooleanToVisibilityConverter}}" />
            <TextBox Name="tbEntry" Background="Transparent" BorderBrush="Indigo" Width="200" Height="40"/>
        </Grid>

    (2)2行代码实现不规则消息提示框

    效果图:

    源代码:

        <Grid Width="300" Height="200">
            <Path x:Name="BackgroundElement" Fill="YellowGreen" Margin="0,0,0,0.06" Stretch="Fill" Stroke="Red" StrokeThickness="1"
                  Data="M6.000001,5.6843419E-13 L179,5.6843419E-13 C182.31371,-1.4230601E-06 185,2.68629 185,5.9999981 L185,35 L185,44 L185,50 L178.84897,50 L163.90877,64.940208 L148.96857,50 L6.000001,50 L0,50 L0,44 L0,35 L0,5.9999981 C0,2.68629 2.6862915,-1.4230601E-06 6.000001,5.6843419E-13 z" />
            <TextBlock HorizontalAlignment="Center" Margin="10,10,0,0" FontSize="20" Foreground="White">This is a Message!</TextBlock>
        </Grid>
    

     设置Grid的Width和Height可以任意设定消息提示框的大小。

  • 相关阅读:
    js高级1
    JUC总览
    7 种阻塞队列相关整理
    Exchanger 相关整理
    Semaphore 相关整理
    ConcurrentLinkedQueue 相关整理
    ConcurrentHashMap(1.8) 相关整理
    ConcurrentHashMap(1.7) 相关整理
    ReentrantReadWriteLock 相关整理
    LockSupport 工具相关整理
  • 原文地址:https://www.cnblogs.com/wangnmhb/p/4193235.html
Copyright © 2011-2022 走看看