From 8d092bd9e8d4186318550801f015e2070819a28f Mon Sep 17 00:00:00 2001 From: Markus Ewald Date: Thu, 18 Feb 2010 18:40:44 +0000 Subject: [PATCH] Removed the EmbeddedControlCollection (it's not being used anymore at all); fixed flickering of the ContainerListView control git-svn-id: file:///srv/devel/repo-conversion/nuwi@29 d2e56fa2-650e-0410-a79f-9358c0239efd --- Nuclex.Windows.Forms.csproj | 3 +- Source/ContainerListView/ContainerListView.cs | 5 +- Source/EmbeddedControlCollection.cs | 132 ------------------ 3 files changed, 5 insertions(+), 135 deletions(-) delete mode 100644 Source/EmbeddedControlCollection.cs diff --git a/Nuclex.Windows.Forms.csproj b/Nuclex.Windows.Forms.csproj index cfc1cec..87d1427 100644 --- a/Nuclex.Windows.Forms.csproj +++ b/Nuclex.Windows.Forms.csproj @@ -1,4 +1,4 @@ - + Debug AnyCPU @@ -89,7 +89,6 @@ ContainerListView.cs - Form diff --git a/Source/ContainerListView/ContainerListView.cs b/Source/ContainerListView/ContainerListView.cs index faaab95..26d8df3 100644 --- a/Source/ContainerListView/ContainerListView.cs +++ b/Source/ContainerListView/ContainerListView.cs @@ -61,7 +61,6 @@ namespace Nuclex.Windows.Forms { this.embeddedControlClickedDelegate = new EventHandler(embeddedControlClicked); this.embeddedControls = new ObservableCollection(); - this.embeddedControls.ItemAdded += new EventHandler>(embeddedControlAdded); this.embeddedControls.ItemRemoved += @@ -69,6 +68,10 @@ namespace Nuclex.Windows.Forms { this.embeddedControls.Clearing += new EventHandler(embeddedControlsClearing); InitializeComponent(); + + // Eliminate flickering + SetStyle(ControlStyles.OptimizedDoubleBuffer, true); + SetStyle(ControlStyles.AllPaintingInWmPaint, true); base.View = View.Details; diff --git a/Source/EmbeddedControlCollection.cs b/Source/EmbeddedControlCollection.cs deleted file mode 100644 index 396e035..0000000 --- a/Source/EmbeddedControlCollection.cs +++ /dev/null @@ -1,132 +0,0 @@ -#region CPL License -/* -Nuclex Framework -Copyright (C) 2002-2007 Nuclex Development Labs - -This library is free software; you can redistribute it and/or -modify it under the terms of the IBM Common Public License as -published by the IBM Corporation; either version 1.0 of the -License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -IBM Common Public License for more details. - -You should have received a copy of the IBM Common Public -License along with this library -*/ -#endregion - -using System; -using System.Collections.Generic; -using System.Windows.Forms; - -namespace Nuclex.Windows.Forms { - - /// Collection of controls embedded in another control - public class EmbeddedControlCollection : Control.ControlCollection { - - #region class ControlEventArgs - - /// Arguments class for events that need to pass a control - public class ControlEventArgs : EventArgs { - - /// Initializes a new event arguments provider - /// Control to be supplied to the event handler - public ControlEventArgs(Control control) { - this.control = control; - } - - /// Obtains the control the event arguments are carrying - public Control Control { get { return this.control; } } - - /// Control that's passed to the event handler - private Control control; - - } - - #endregion // class ControlEventArgs - - /// Raised when a control has been added to the collection - public event EventHandler ControlAdded; - /// Raised when a control is removed from the collection - public event EventHandler ControlRemoved; - - /// Initializes a new instance of the EmbeddedControlCollection class - /// - /// A System.Windows.Forms.Control representing the control - /// that owns the control collection - /// - EmbeddedControlCollection(Control owner) : base(owner) { } - - /// Adds the specified control to the control collection - /// - /// The System.Windows.Forms.Control to add to the control collection - /// - public override void Add(Control value) { - base.Add(value); - - OnControlAdded(value); - } - - /// Removes the specified control from the control collection - /// - /// The System.Windows.Forms.Control to remove from the EmbeddedControlCollection - /// - public override void Remove(Control value) { - base.Remove(value); - - OnControlRemoved(value); - } - - // These three methods don't need an override since their current implementations - // in the .NET Framework 2.0 all call the Remove() method on each individual control. - // The ControlAdded/ControlRemoved events weren't in the original class and there - // are other designs you could use to guarantee that removed controls get disposed - // properly, so this should be rechecked when the code is compiled on another - // version of the .NET framework - /* - /// Adds an array of control objects to the collection - /// - /// An array of System.Windows.Forms.Control objects to add to the collection - /// - public override void AddRange(Control[] controls) { - base.AddRange(controls); - } - - /// Removes all controls from the collection - public override void Clear() { - base.Clear(); - } - - /// Removes the child control with the specified key - /// The name of the child control to remove - public override void RemoveByKey(string key) { - base.RemoveByKey(key); - } - */ - - /// - /// Called when a control has been added to the collection, - /// fires the ControlAdded event - /// - /// Control that has been added to the collection - protected virtual void OnControlAdded(Control control) { - if(ControlAdded != null) - ControlAdded(this, new ControlEventArgs(control)); - } - - /// - /// Called when a control has been removed to the collection, - /// fires the ControlRemoved event - /// - /// Control that has been removed from the collection - protected virtual void OnControlRemoved(Control control) { - if(ControlRemoved != null) - ControlRemoved(this, new ControlEventArgs(control)); - } - - } - -} // namespace Nuclex.Windows.Forms