示例#1
0
文件: Theming.cs 项目: gtrant/eraser
        /// <summary>
        /// Updates the control's theme to fit in with the latest Windows visuals.
        /// </summary>
        /// <param name="cb">The Combobox control to set the theme on.</param>
        public static void ApplyTheme(ComboBox cb)
        {
            //No themeing. I lied. This is to make focus behaviour work as expected.
            //Find all containers this belongs in and assign them a click handler.
            Control parent = cb.Parent;

            while (parent != null)
            {
                ScrollableControl container = parent as ScrollableControl;
                if (container != null && !ThemedContainers.Contains(container))
                {
                    container.Click    += OnContainerClicked;
                    container.Disposed += OnContainerDisposed;
                    ThemedContainers.Add(container);
                }
                parent = parent.Parent;
            }
        }
示例#2
0
文件: Theming.cs 项目: gtrant/eraser
 /// <summary>
 /// Clean up the reference to the container control when it is disposed
 /// so we allow garbage collection.
 /// </summary>
 private static void OnContainerDisposed(object sender, EventArgs e)
 {
     ThemedContainers.Remove((ScrollableControl)sender);
 }