Ejemplo n.º 1
0
        /// <summary>
        /// copies values in control of 'editorFrom' into 'editorTo'
        /// </summary>
        /// <param name="editorTo"></param>
        /// <param name="editorFrom"></param>
        private void CopyEditorValues(TableEditor editorTo, TableEditor editorFrom)
        {
            // For ComboBox unregister SelectedIndexChangeHandler before copying new values and then register again.
            if (editorTo.Control is ComboBox)
            {
                ((ComboBox)editorTo.Control).SelectedIndexChanged -= ComboHandler.getInstance().SelectedIndexChangedHandler;
            }

            editorTo.Control.Text      = editorFrom.Control.Text;
            editorTo.Control.ForeColor = editorFrom.Control.ForeColor;
            editorTo.Control.BackColor = editorFrom.Control.BackColor;
            editorTo.Control.Font      = editorFrom.Control.Font;
            editorTo.Control.Enabled   = editorFrom.Control.Enabled;
            editorTo.Control.Visible   = editorFrom.Control.Visible;
            editorTo.Control.Bounds    = editorFrom.Control.Bounds;
            editorTo.Control.Tag       = editorFrom.Control.Tag;

#if !PocketPC
            editorTo.Control.BackgroundImage = editorFrom.Control.BackgroundImage;
            if (editorTo.Control is ButtonBase && editorFrom.Control is ButtonBase)
            {
                ((ButtonBase)editorTo.Control).Image = ((ButtonBase)editorFrom.Control).Image;
            }
            editorTo.Control.AllowDrop = editorFrom.Control.AllowDrop;
            GuiUtils.setTooltip(editorTo.Control, GuiUtils.getTooltip(editorFrom.Control));
#endif
            if (editorTo.Control is ComboBox)
            {
                ((ComboBox)editorTo.Control).SelectedIndexChanged += ComboHandler.getInstance().SelectedIndexChangedHandler;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// clear the value of control in 'editor'
        /// </summary>
        /// <param name="editor"></param>
        private void ClearEditorValues(TableEditor editor)
        {
            // For Combobox unregister SelectedIndexChangeHandler before clearing the selection and then register again.
            if (editor.Control is ComboBox)
            {
                ((ComboBox)editor.Control).SelectedIndexChanged -= ComboHandler.getInstance().SelectedIndexChangedHandler;
            }

            editor.Control.Text      = "";
            editor.Control.ForeColor = SystemColors.WindowText;
            editor.Control.BackColor = SystemColors.Window;
            editor.Control.Enabled   = true;
            editor.Control.Visible   = true;
            editor.Control.Bounds    = new Rectangle(0, 0, 0, 0);
            editor.Control.Tag       = new TagData();
            ((TagData)editor.Control.Tag).IsEditor = true;

#if !PocketPC
            editor.Control.BackgroundImage = null;
            if (editor.Control is ButtonBase)
            {
                ((ButtonBase)editor.Control).Image = null;
            }
            editor.Control.AllowDrop = true;
            GuiUtils.setTooltip(editor.Control, "");
#endif
            if (editor.Control is ComboBox)
            {
                ((ComboBox)editor.Control).SelectedIndexChanged += ComboHandler.getInstance().SelectedIndexChangedHandler;
            }
        }
Ejemplo n.º 3
0
        internal static ComboHandler getInstance()
        {
            if (_instance == null)
            {
                _instance = new ComboHandler();
            }

            return(_instance);
        }