简体   繁体   English

Windows Store App使用C#-如何更改RGB中的TextBlock颜色?

[英]Windows Store App using C# - how to change TextBlock color in RGB?

I know this: myRectangle.Fill = new SolidColorBrush(Colors.Red); 我知道: myRectangle.Fill = new SolidColorBrush(Colors.Red);

how to do it in RGB combination color? 如何以RGB组合颜色进行制作?

You can use 您可以使用

//Color.FromArgb(red,green,blue ) ;
Color blue=Color.FromArgb(0,0,255):

of course you can put other numbers to get your desired color 当然,您可以输入其他数字以获得所需的颜色

You can use Color.FromArgb method. 您可以使用Color.FromArgb方法。

Example: 例:

Color red = Color.FromArgb(255, 0, 0);
SolidBrush  myBrush = new SolidBrush(red);

Then: 然后:

myRectangle.Fill = myBrush;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Windows商店App中使用C#动态添加TextBlock - Dynamically adding TextBlock using C# in Windows store App Windows应用商店-C#-TextBlock检查文本是否被修剪 - Windows Store App - C# - TextBlock check if text is trimmed 在Windows Phone中使用C#更改StackPanel内部Textblock的前景色 - change foreground color of textblock inside stackpanel using c# in windows phone 如何将文本框的文本获取到另一个 xaml 中的文本块? c# windows store app - How to get the text of textbox to textblock in another xaml? c# windows store app 如何从绑定的TextBlock Store App C#中获取文本 - How To Get Text From Binded TextBlock Store App c# C#-如何将前景色更改为自定义RGB值 - C# - How to change Fore Color to custom RGB value 如何在C#/ Windows应用商店应用中更改CultureInfo.CurrentCulture - How to change CultureInfo.CurrentCulture in a C#/Windows Store app 如何在WinRT / Windows应用商店应用中使用C#实用地更改文本文件编码 - How to change text file encoding pragmatically using C# in WinRT/Windows store app 如何使用C#检索Windows Store应用程序中的所有联系人 - How to retrieve all contacts in Windows Store app using c# 淡入/淡出Windows应用商店应用程序中的TextBlock [XAML / C#] - Fade in/out a TextBlock in a Windows Store Application [XAML/C#]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM