当前位置: 首页>>代码示例>>C#>>正文


C# GridEntry.GetPropertyValueList方法代码示例

本文整理汇总了C#中System.Windows.Forms.PropertyGridInternal.GridEntry.GetPropertyValueList方法的典型用法代码示例。如果您正苦于以下问题:C# GridEntry.GetPropertyValueList方法的具体用法?C# GridEntry.GetPropertyValueList怎么用?C# GridEntry.GetPropertyValueList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.PropertyGridInternal.GridEntry的用法示例。


在下文中一共展示了GridEntry.GetPropertyValueList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetCurrentValueIndex

        private int GetCurrentValueIndex(GridEntry gridEntry) {

            if (!gridEntry.Enumerable) {
                return -1;
            }

            try {
                object[] values = gridEntry.GetPropertyValueList();
                object value = gridEntry.PropertyValue;
                string textValue = gridEntry.TypeConverter.ConvertToString(gridEntry, value);

                if (values != null && values.Length > 0) {
                    string itemTextValue;
                    int stringMatch = -1;
                    int equalsMatch = -1;
                    for (int i = 0; i < values.Length; i++) {

                        object curValue = values[i];

                        // check real values against string values.
                        itemTextValue = gridEntry.TypeConverter.ConvertToString(curValue);
                        if (value == curValue || 0 == String.Compare(textValue, itemTextValue, true, CultureInfo.InvariantCulture)) {
                            stringMatch = i;
                        }
                        // now try .equals if they are both non-null
                        if (value != null && curValue != null && curValue.Equals(value)) {
                            equalsMatch = i;
                        }

                        if (stringMatch == equalsMatch && stringMatch != -1) {
                            return stringMatch;
                        }
                    }

                    if (stringMatch != -1) {
                        return stringMatch;
                    }

                    if (equalsMatch != -1) {
                        return equalsMatch;
                    }
                }
            }
            catch (Exception e) {
                Debug.Fail(e.ToString());
            }
            return -1;

        }
开发者ID:mind0n,项目名称:hive,代码行数:49,代码来源:PropertyGridView.cs

示例2: GetCurrentValueIndex

 private int GetCurrentValueIndex(GridEntry gridEntry)
 {
     if (gridEntry.Enumerable)
     {
         try
         {
             object[] propertyValueList = gridEntry.GetPropertyValueList();
             object propertyValue = gridEntry.PropertyValue;
             string strA = gridEntry.TypeConverter.ConvertToString(gridEntry, propertyValue);
             if ((propertyValueList != null) && (propertyValueList.Length > 0))
             {
                 int num = -1;
                 int num2 = -1;
                 for (int i = 0; i < propertyValueList.Length; i++)
                 {
                     object obj3 = propertyValueList[i];
                     string strB = gridEntry.TypeConverter.ConvertToString(obj3);
                     if ((propertyValue == obj3) || (string.Compare(strA, strB, true, CultureInfo.InvariantCulture) == 0))
                     {
                         num = i;
                     }
                     if (((propertyValue != null) && (obj3 != null)) && obj3.Equals(propertyValue))
                     {
                         num2 = i;
                     }
                     if ((num == num2) && (num != -1))
                     {
                         return num;
                     }
                 }
                 if (num != -1)
                 {
                     return num;
                 }
                 if (num2 != -1)
                 {
                     return num2;
                 }
             }
         }
         catch (Exception)
         {
         }
     }
     return -1;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:46,代码来源:PropertyGridView.cs


注:本文中的System.Windows.Forms.PropertyGridInternal.GridEntry.GetPropertyValueList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。