zoukankan      html  css  js  c++  java
  • WPF文本控件及实现(1)

    基础控件:<TextBlock Text="添加文字"

    FontFamily=" 字体

    "FontSize=" 字号" 

    FontWeight="设置文本粗细"

    Foreground="前景色(字体颜色)"
    TextAlignment="文本内容的水平对齐方式,默认值为left"
    TextTrimming="获取或设置在内容超出内容区域时要采用的文本剪裁行为,默认值为None">

    </TextBlock>

    代码如下:

    <Window x:Class="WPFextControl.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
            xmlns:local="clr-namespace:WPFextControl"
            mc:Ignorable="d"
            Title="MainWindow" Height="350" Width="525">
        <StackPanel >
            <TextBlock Text=" WPF TextBlock" FontFamily=" 宋体" FontSize=" 16" 
                       FontWeight="Bold" Foreground="Red" 
                       TextWrapping="NoWrap"  TextAlignment="Center"  ></TextBlock>
            <TextBlock Text="北方的春晨,依旧寒凉,紧紧地把体温拽在手心,阡陌荒凉,静默无声,我开始情不自禁幻想南国风情,应是花草丛丛,细雨蒙蒙。伞花美丽了巷陌,青阶,谁撑一把素洁的白伞,痴目远眺,一怀温情。而我的江北终究无法飞越你的江南,冷寒,笼袖。" 
                       FontFamily=" 宋体" FontSize=" 16" 
                       FontWeight="Bold" Foreground="Red" 
                        TextAlignment="Left"
                       TextTrimming="CharacterEllipsis"  ></TextBlock>
            
            <TextBlock Text="Muslims have been leaving Buddhist-majority Myanmar, also known as Burma, because they are not recognised as citizens of the country and face persecution. Many of the Bangladeshis at sea are thought to be economic migrants."                                 
                       FontFamily=" 宋体" FontSize=" 16" 
                       FontWeight="Bold" Foreground="Red" 
                        TextAlignment="Left"
                       TextTrimming="WordEllipsis"   ></TextBlock>
            
            <TextBlock Text="Muslims have been leaving Buddhist-majority Myanmar, also known as Burma, because they are not recognised as citizens of the country and face persecution. Many of the Bangladeshis at sea are thought to be economic migrants."              
                       FontFamily=" 宋体" FontSize=" 16" 
                       FontWeight="Bold" Foreground="Red" 
                       TextAlignment="Left"
                       TextTrimming="CharacterEllipsis"  ></TextBlock>
            <local:MyTextBox Loaded="MyTextBox_Loaded"></local:MyTextBox>
        </StackPanel >
    </Window>
  • 相关阅读:
    【转】每天一个linux命令(41):ps命令
    【转】每天一个linux命令(40):wc命令
    【转】每天一个linux命令(39):grep 命令
    【转】每天一个linux命令(38):cal 命令
    【转】每天一个linux命令(37):date命令
    【转】每天一个linux命令(36):diff 命令
    【转】每天一个linux命令(35):ln 命令
    【转】每天一个linux命令(34):du 命令
    诗词、对联名句(千古名帖)
    诗词、对联名句(千古名帖)
  • 原文地址:https://www.cnblogs.com/programme-maker/p/10794758.html
Copyright © 2011-2022 走看看