本文整理汇总了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;
}
示例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;
}