1

表单上有 Button2 控件。我在更改其名称时遇到问题:

属性值无效

或者

属性“BackgroundImage”的代码生成失败

Button2 控件杂项属性:

Button2 控件杂项属性

我怎么解决这个问题?

正如我所提到的,我应该将 Build Action: None?添加到我的项目DesignTimeAttributes.xmta文件中。

我使用 .NET Compact Framework 3.5/Visual Studio 2008/OpenNETCF Smart Device Framework 2.3 库(社区版)

4

1 回答 1

1

我有同样的问题。我在构造函数中删除了所有初始化代码(除了对 InitializeComponent 的调用),但仍然有这个问题。我可以通过添加包含以下内容的 DesignTimeAttributes.xmta 文件来解决该问题:

<Class Name="OpenNETCF.Widows.Forms.Button2">
    <DesktopCompatible>true</DesktopCompatible>
    <DesignTimeVisible>true</DesignTimeVisible>
    <Property Name="BackgroundImage">
      <Category>Misc</Category>
      <DefaultValue>
        <Type>System.Drawing.Image, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Type>
      </DefaultValue>
      <Description>The background image displayed for the control.</Description>
    </Property>
  </Class>
于 2014-04-15T11:55:49.607 回答