Ejemplo n.º 1
0
        // Allow users to type an ID in addition to the item itself.
        // To do this, retrieve the editor value, check if it's an integer, and look it up
        // in the dictionary. If an entry is found, replace the editor contents with it.
        void _flex_ValidateEdit(object sender, C1.Win.C1FlexGrid.ValidateEditEventArgs e)
        {
            // check that we have a combo and a multi-column dictionary
            ComboBox cb = _flex.Editor as ComboBox;
            IC1MultiColumnDictionary mcd = _flex.Cols[e.Col].DataMap as IC1MultiColumnDictionary;

            if (cb != null && mcd != null)
            {
                // check that the current value is an integer
                double d = 0;
                if (double.TryParse(cb.Text, NumberStyles.Integer, CultureInfo.CurrentCulture, out d))
                {
                    // look up entry using current content as key
                    string text = mcd.GetDisplayValue((int)d);
                    if (text.Length > 0)
                    {
                        // found, fix editor
                        cb.Text = text;
                    }
                    else
                    {
                        // not found, fail validation
                        e.Cancel = true;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        void c1_dgwPlugin_ValidateEdit(object sender, C1.Win.C1FlexGrid.ValidateEditEventArgs e)
        {
            Row boundControl = c1_dgwPlugin.Rows[e.Row];

            if ((CheckEnum)e.Checkbox == CheckEnum.Checked)
            {
                c1_dgwPlugin.Rows[e.Row].StyleNew.BackColor = Color.LightSteelBlue;
                var pluginObject = boundControl.DataSource as PluginObject;
                _controlerFrmMain.PluginObjects.Add(pluginObject);
            }
            else
            {
                c1_dgwPlugin.Rows[e.Row].StyleNew.BackColor = Color.White;
            }
        }
Ejemplo n.º 3
0
 private static void fg_ValidateEdit(object sender, C1.Win.C1FlexGrid.ValidateEditEventArgs e)
 {
     if (fg.Cols[e.Col].Name == "变形温度" || fg.Cols[e.Col].Name == "软化温度" || fg.Cols[e.Col].Name == "半球温度" || fg.Cols[e.Col].Name == "流动温度")
     {
         string text = ((TextBox)((C1.Win.C1FlexGrid.C1FlexGrid)sender).Editor).Text.Trim();
         if (text != null && text.Length > 0)  //值可以为空
         {
             try
             {       //值可以为空
                     //if (text.Length == 0)
                     //{
                     //    MessageBox.Show(Resource1.SpaceError, Resource1.HintCaption, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                     //    e.Cancel = true;
                     //}
                     //else
                 {
                     if (text.Length > 1 && text.Substring(0, 1) == ">")
                     {
                         text = text.Substring(1, text.Length - 1);
                     }
                     int value = int.Parse(text);
                     if (value >= 500 && value <= 1600)
                     {
                         e.Cancel = false;
                     }
                     else
                     {
                         MessageBox.Show(Resource1.InputLimit + " 500~1600  ", Resource1.HintCaption, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                         e.Cancel = true;
                     }
                 }
             }
             catch
             {
                 MessageBox.Show(Resource1.ErrChar, Resource1.HintCaption, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 e.Cancel = true;
             }
         }
     }
 }
Ejemplo n.º 4
0
 void _flex_ValidateEdit(object sender, C1.Win.C1FlexGrid.ValidateEditEventArgs e)
 {
     //e.Cancel = true;
     Console.WriteLine("_flex_ValidateEdit {0} {1}", e.Row, e.Col, e.Cancel);
 }