예제 #1
0
        public bool AddLayoutHook(string setUniqueId, ModifyLayout layoutCode)
        {
            if (customLayoutHooks.ContainsKey(setUniqueId))
            {
                return(false);
            }

            customLayoutHooks.Add(setUniqueId, layoutCode);
            return(true);
        }
예제 #2
0
        /// <summary>
        /// Allows the caller to modify multiple layout-affecting properties without causing invokes of
        /// multiple PerformLayout() events.
        ///
        /// For example, setting Width and Height indivually causes two PerformLayout()s to be invoked.
        /// Using BulkPerformLayout allows the user to modify multiple properties with only one
        /// PerformLayout() call, thus saving CPU power.
        /// </summary>
        /// <param name="modifyLayoutCode">Code to be executed that modifies layout-essential code.</param>
        public void BulkPerformLayout(ModifyLayout modifyLayoutCode)
        {
            try
            {
                suppressPerformLayout = true;

                modifyLayoutCode?.Invoke(this);
            }
            finally
            {
                suppressPerformLayout = false;
                PerformLayout();
            }
        }