C#WPF文本框边框 [英] C# WPF textbox border

查看:450
本文介绍了C#WPF文本框边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何让texrt的边框像苹果mac文本框一样圆润,我看到了一个选项,但它似乎没有做任何事情!有人可以帮忙吗?

解决方案

相信我。您需要将其放入 Border 元素并对其应用舍入。你甚至可以看起来是高架或凹陷。只需仔细考虑,考虑颜色,厚度和圆角半径。



例如:



< pre lang =xml> < Border BorderThickness = 1.2 1.2 0 0 CornerRadius = 3.2 BorderBrush = 黑色 背景 = 黄色 < span class =code-attribute>高度 = 20 保证金 = 6 >
< 边框 BorderThickness = 0 0 1.2 1.2 CornerRadius = 3.2 BorderBrush = 白色 填充 = 1 >
< TextBlock 宽度 = 130 高度 = 30 背景 = 透明 TextAlignment = 中心 > 某些文字< / TextBlock >
< / Border >
< / Border >





-SA


解决方案2:此解决方案适合我。



< TextBlock Grid.Row =2Grid.Column =4FontSize =18FontWeight =BoldText =My Text/ >

< Grid Grid.Row =2Grid.Column =4Grid.RowSpan =1Grid.ColumnSpan =1>

< Border Grid.Row =1Grid.Column =1BorderBrush =BlackBorderThickness =1/>


how do i make the border of texrt rounded like the apple mac textboxs, i saw a option onthe propties but it didn't seemto do anything! can some one help?

解决方案

It does, believe me. You need to put it into Border element and apply rounding to it. You can even make is seem elevated or recessed. Just do it carefully, consider colors, thickness and radius of rounding.

For example:

<Border BorderThickness="1.2 1.2 0 0" CornerRadius="3.2" BorderBrush="Black" Background="Yellow" Height="20" Margin="6">
    <Border BorderThickness="0 0 1.2 1.2" CornerRadius="3.2" BorderBrush="White" Padding="1">
        <TextBlock Width="130" Height="30" Background="Transparent" TextAlignment="Center">Some Text</TextBlock>
    </Border>
</Border>



—SA


Solution 2: This solution worked for me.

<TextBlock Grid.Row="2" Grid.Column="4" FontSize="18" FontWeight="Bold" Text="My Text" />
<Grid Grid.Row="2" Grid.Column="4" Grid.RowSpan="1" Grid.ColumnSpan="1">
<Border Grid.Row="1" Grid.Column="1" BorderBrush="Black" BorderThickness="1" />


这篇关于C#WPF文本框边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆