如何设置控制在Windows 8商店应用程序背景颜色 [英] How to set a background color of a control in windows 8 store application
问题描述
我设计的应用程序,并且必须通过实例化code控制。问题是,我无法改变背景颜色。我试图寻找所有在互联网上,但没有更迭。我所接触的微软支持服务,但没有任何更迭
我看了您通常使用System.Color或System.ColorHelper改变颜色。两者都没有在应用入店。
那么如何解决以下问题:
文本框^ txtID = REF新的TextBox();
txtID->背景=?;
我有解决方案,先刷对象,并设置颜色,并指定了颜色你的控件的背景。我用下面的:
的SolidColorBrush ^ myBrush = REF新的SolidColorBrush(视窗:: UI ::颜色::红色);
文本框^ txtID = REF新的TextBox();
txtID->背景= myBrush;
I am designing an application and had to instantiate controls via code. The problem is that I am unable to change the background color. I tried to look all over the internet, but no succes. I have contacted the Microsoft support service, but no succes either.
I read that you normally change a color by using System.Color or System.ColorHelper. Both are not accesible in the application.
So how to solve the following problem:
TextBox^ txtID = ref new TextBox();
txtID->Background = ?;
I have the solution, first make a brush object and set the color and assign that color to your controls background. I used the following:
SolidColorBrush^ myBrush = ref new SolidColorBrush(Windows::UI::Colors::Red);
TextBox^ txtID = ref new TextBox();
txtID->Background = myBrush;
这篇关于如何设置控制在Windows 8商店应用程序背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!