/// <summary> /// </summary> /// <param name="disposing"><see langword="true"/> to release both managed and unmanaged resources; <see langword="false"/> to release only unmanaged resources.</param> protected override void Dispose(bool disposing) { if (disposing) { if (_pictureBox != null) { _pictureBox.DisplayModeChanged -= _pictureBox_DisplayModeChanged; _pictureBox.ImageChanged -= _pictureBox_ImageChanged; _pictureBox.ZoomFactorChanged -= _pictureBox_ZoomFactorChanged; _pictureBox.Dispose(); _pictureBox = null; } } base.Dispose(disposing); }
/// <summary> /// Initializes a new instance of the <see cref="NuGenSmoothPictureBox"/> class. /// </summary> /// <param name="serviceProvider"> /// <para>Requires:</para> /// <para><see cref="INuGenControlStateTracker"/></para> /// <para><see cref="INuGenPanelRenderer"/></para> /// <para><see cref="INuGenPictureBoxRenderer"/></para> /// <para><see cref="INuGenSmoothPictureBoxLayoutManager"/></para> /// </param> public NuGenSmoothPictureBox(INuGenServiceProvider serviceProvider) : base(serviceProvider) { this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.SetStyle(ControlStyles.ResizeRedraw, true); this.SetStyle(ControlStyles.Selectable, true); this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); this.SetStyle(ControlStyles.UserPaint, true); this.BackColor = Color.Transparent; this.Padding = this.LayoutManager.GetInternalPictureBoxPadding(); _pictureBox = new NuGenPictureBox(serviceProvider); _pictureBox.BackColor = Color.Transparent; _pictureBox.Dock = DockStyle.Fill; _pictureBox.DisplayModeChanged += _pictureBox_DisplayModeChanged; _pictureBox.ImageChanged += _pictureBox_ImageChanged; _pictureBox.ZoomFactorChanged += _pictureBox_ZoomFactorChanged; _pictureBox.Parent = this; }