Ejemplo n.º 1
0
        /// <summary>
        ///  Edit conditional formatting
        /// </summary>
        /// <param name="cf"></param>
        /// <param name="title"></param>
        /// <returns></returns>

        public static CondFormat Edit(
            CondFormat cf,
            bool editForUserObjectStorage = false,
            string title = "Conditional Formatting Rules")
        {
            InitialSerializedForm = cf.Serialize();             // save for later compare
            //if (Instance == null) // always create new instance because the any changed height of the grid editor controls is maintained otherwise
            Instance = new CondFormatEditor();

            Instance.Text = title;
            Instance.ShowEditorWhenActivated  = true;
            Instance.EditForUserObjectStorage = editForUserObjectStorage;
            Instance.CondFormatToForm(cf);

            DialogResult dr = Instance.ShowDialog(SessionManager.ActiveForm);

            if (dr == DialogResult.Cancel)
            {
                return(null);
            }

            cf = Instance.FormToCondFormat();

            cf.Rules.InitializeInternalMatchValues(cf.ColumnType);

            return(cf);
        }