Beispiel #1
0
        public static Size FormatToSize(string sizeString)
        {
            var retVal = new Size(-1, -1);

            try
            {
                var tmpItemList = StringHelper.SplitString(sizeString, "*");
                if (tmpItemList.Count == 2)
                {
                    retVal = new Size(ConvertHelper.GetInt(tmpItemList.First(), -1), ConvertHelper.GetInt(tmpItemList.Last(), -1));
                }
            }
            catch { }
            return(retVal);
        }
Beispiel #2
0
        public static Point FormatToPoint(string pointString)
        {
            var retVal = new Point(-1, -1);

            try
            {
                var tmpItemList = StringHelper.SplitString(pointString, ",");
                if (tmpItemList.Count == 2)
                {
                    retVal = new Point(ConvertHelper.GetInt(tmpItemList.First(), -1), ConvertHelper.GetInt(tmpItemList.Last(), -1));
                }
            }
            catch { }
            return(retVal);
        }
Beispiel #3
0
 /// <summary>
 /// 判断枚举值是否存在
 /// </summary>
 public static bool IsDefined(Type enumType, object value)
 {
     try
     {
         if (enumType.IsEnum && value != null)
         {
             if (ConvertHelper.IsIntegerType(value.GetType()))
             {
                 return(enumType.IsEnumDefined(ConvertHelper.GetInt(value)));
             }
             return(enumType.IsEnumDefined(value));
         }
     }
     catch { }
     return(false);
 }