Exemplo n.º 1
0
        public void SetString(string dataStr)
        {
            if (canPaint)
            {
                loadString = dataStr;
            }
            switch (ComboType)
            {
            case EnmComboType.ExItem:
                int i = 0;
                foreach (string exData in exItems)
                {
                    if (exData == dataStr)
                    {
                        SelectedIndex = i;
                        break;
                    }
                    i++;
                }
                break;

            case EnmComboType.ToChar:
                i = 0;
                foreach (string item in Items)
                {
                    if (dataStr == ArsLibrary.ToChar(item, ArsChar))
                    {
                        SelectedIndex = i;
                        break;
                    }
                    i++;
                }
                break;

            case EnmComboType.Index:
                SelectedIndex = Convert.ToInt32(Convert.ToDouble(dataStr.Replace(".", ",")));
                break;

            case EnmComboType.All:
                i = 0;
                foreach (string item in Items)
                {
                    if (dataStr == item)
                    {
                        SelectedIndex = i;
                        break;
                    }
                    i++;
                }
                break;
            }
        }
Exemplo n.º 2
0
        public string GetString()
        {
            switch (ComboType)
            {
            case EnmComboType.ExItem:
                if (exItems.Count == 0 || SelectedIndex >= exItems.Count || SelectedIndex < 0)
                {
                    return("");
                }
                return(exItems[SelectedIndex]);

            case EnmComboType.ToChar:
                return(ArsLibrary.ToChar(Text, ArsChar));

            case EnmComboType.All:
                return(Text);

            case EnmComboType.Index:
                return(SelectedIndex.ToString());
            }

            return("");
        }