當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。