• <bdo id='sEGuB'></bdo><ul id='sEGuB'></ul>

    <small id='sEGuB'></small><noframes id='sEGuB'>

  • <legend id='sEGuB'><style id='sEGuB'><dir id='sEGuB'><q id='sEGuB'></q></dir></style></legend>

  • <i id='sEGuB'><tr id='sEGuB'><dt id='sEGuB'><q id='sEGuB'><span id='sEGuB'><b id='sEGuB'><form id='sEGuB'><ins id='sEGuB'></ins><ul id='sEGuB'></ul><sub id='sEGuB'></sub></form><legend id='sEGuB'></legend><bdo id='sEGuB'><pre id='sEGuB'><center id='sEGuB'></center></pre></bdo></b><th id='sEGuB'></th></span></q></dt></tr></i><div id='sEGuB'><tfoot id='sEGuB'></tfoot><dl id='sEGuB'><fieldset id='sEGuB'></fieldset></dl></div>

        <tfoot id='sEGuB'></tfoot>

        以编程方式隐藏 PropertyGrid 中的字段

        时间:2023-07-27
          <tbody id='FboVB'></tbody>
          • <i id='FboVB'><tr id='FboVB'><dt id='FboVB'><q id='FboVB'><span id='FboVB'><b id='FboVB'><form id='FboVB'><ins id='FboVB'></ins><ul id='FboVB'></ul><sub id='FboVB'></sub></form><legend id='FboVB'></legend><bdo id='FboVB'><pre id='FboVB'><center id='FboVB'></center></pre></bdo></b><th id='FboVB'></th></span></q></dt></tr></i><div id='FboVB'><tfoot id='FboVB'></tfoot><dl id='FboVB'><fieldset id='FboVB'></fieldset></dl></div>
            <tfoot id='FboVB'></tfoot>
          • <small id='FboVB'></small><noframes id='FboVB'>

                  <bdo id='FboVB'></bdo><ul id='FboVB'></ul>

                  <legend id='FboVB'><style id='FboVB'><dir id='FboVB'><q id='FboVB'></q></dir></style></legend>
                  本文介绍了以编程方式隐藏 PropertyGrid 中的字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  使用

                  <System.ComponentModel.TypeConverter(GetType(System.ComponentModel.ExpandableObjectConverter))> _
                  

                  关于一个类的声明(它是另一个类的属性),它由一个数字属性组成.

                  on the declaration of a class (which is a property of another class) that consists of a number properties.

                  我只用 ... 加载这个类的一个实例

                  I load an instance of this class with simply ...

                  PropertyGrid1.SelectedObject = oColumn
                  

                  显然我不想在代码中手动构建 propertygrid,我知道该怎么做.

                  Obviously I don't want to manually build the propertygrid in code, I know how to do that.

                  但这就是问题所在.根据属性的值,某些其他属性不应该是可见的,就好像我使用了

                  But here's the problem. Depending on the value of a property, certain other properties should not be visible, as though I'd used the

                  <System.ComponentModel.Browsable(False)> _
                  

                  属性声明.

                  有没有办法以编程方式执行此操作,而无需手动处理属性网格的所有构建>

                  Is there anyway to do this programmatically, without having to handle all the building of the property grid manually>

                  推荐答案

                  如果您希望使用 gridItem.Hide(),那么答案是否定的.在 MS PropertyGrid 中实现这一点的唯一方法是通过 TypeConverter 或自定义类型描述符(实现 ICustomTypeDescriptor)的 GetProperties 方法动态发布您的属性.我会先尝试使用 TypeConverter(特别是如果您要检查的属性值处于同一级别),需要做的编码更少.

                  if you were hoping for a gridItem.Hide() then, the answer is no. The only way to achieve that in the MS PropertyGrid is to dynamically publish your properties through the GetProperties method of a TypeConverter or custom type descriptor (that implements ICustomTypeDescriptor). I would try first with the TypeConverter (expecially if the property values you want to check are at the same level), there is less coding to do.

                  这篇关于以编程方式隐藏 PropertyGrid 中的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:.NET 属性的历史前身是什么? 下一篇:仅在特定类型上允许自定义属性

                  相关文章

                  • <bdo id='v7ec7'></bdo><ul id='v7ec7'></ul>
                • <small id='v7ec7'></small><noframes id='v7ec7'>

                      <legend id='v7ec7'><style id='v7ec7'><dir id='v7ec7'><q id='v7ec7'></q></dir></style></legend>

                    1. <tfoot id='v7ec7'></tfoot>
                    2. <i id='v7ec7'><tr id='v7ec7'><dt id='v7ec7'><q id='v7ec7'><span id='v7ec7'><b id='v7ec7'><form id='v7ec7'><ins id='v7ec7'></ins><ul id='v7ec7'></ul><sub id='v7ec7'></sub></form><legend id='v7ec7'></legend><bdo id='v7ec7'><pre id='v7ec7'><center id='v7ec7'></center></pre></bdo></b><th id='v7ec7'></th></span></q></dt></tr></i><div id='v7ec7'><tfoot id='v7ec7'></tfoot><dl id='v7ec7'><fieldset id='v7ec7'></fieldset></dl></div>