2015-10-06 21 views
0

我正在设计一个应用程序,并且必须通过代码实例化控件。问题是我无法改变背景颜色。我试图在整个互联网上看,但没有成功。我已经联系了Microsoft支持服务,但没有成功。如何在Windows 8商店应用程序中设置控件的背景颜色

我读到你通常使用System.Color或System.ColorHelper改变颜色。两者在应用程序中都不可访问。

那么如何解决以下问题:

TextBox^ txtID = ref new TextBox(); 
txtID->Background = ?; 

回答

1

我有解决方案,首先要刷对象并设置颜色,并指定该颜色到你的管制背景。我用了以下内容:

SolidColorBrush^ myBrush = ref new SolidColorBrush(Windows::UI::Colors::Red); 
TextBox^ txtID = ref new TextBox(); 
txtID->Background = myBrush; 
相关问题