【问题标题】:How to set a background color of a control in windows 8 store application如何在 Windows 8 商店应用程序中设置控件的背景颜色
【发布时间】:2016-01-03 06:53:33
【问题描述】:

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

我了解到您通常使用 System.Color 或 System.ColorHelper 更改颜色。两者都不能在应用程序中访问。

那么如何解决以下问题:

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

【问题讨论】:

    标签: background microsoft-metro c++-cx


    【解决方案1】:

    我有解决方案,首先制作一个画笔对象并设置颜色并将该颜色分配给您的控件背景。我使用了以下内容:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多