예제 #1
0
        private void RestoreControlState(UndoControlState state)
        {
            var elem = state.Element;
            var ctl  = elem as Control;

            if (ctl != null && (state.Operation & UndoOperation.Position) != 0)
            {
                ctl.SuspendLayout();
                ctl.SetBounds(state.Bounds.X, state.Bounds.Y, state.Bounds.Width, state.Bounds.Height);
                ctl.ResumeLayout();
            }
            if ((state.Operation & UndoOperation.Text) != 0)
            {
                TranslationToolHelperWinClient.SetComponentText(elem, state.Caption);
            }
            if (ctl != null && (state.Operation & UndoOperation.Visibility) != 0)
            {
                ctl.Visible = state.Visible;
            }
            if (state.RelatedChanges != null && state.RelatedChanges.Length > 0)
            {
                foreach (var change in state.RelatedChanges)
                {
                    RestoreControlState(change);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Проставляет нужное текстовое свойство в зависимости от типа контрола
        /// </summary>
        /// <param name="control"></param>
        /// <param name="caption"></param>
        /// <param name="editedObject"> </param>
        public static void SetControlText(Control control, string caption, object editedObject = null)
        {
            var proxy = control as ControlDesignerProxy;

            if (proxy != null)
            {
                SetControlText(proxy.HostControl, caption, editedObject);
                return;
            }
            TranslationToolHelperWinClient.SetComponentText(editedObject ?? control, caption);
        }