using System; using System.Collections.Generic; using System.Text; using System.Drawing; namespace DevComponents.DotNetBar.Layout { public class PaintContext : IDisposable { /// /// Initializes a new instance of the PaintContext class. /// /// /// public PaintContext(LayoutControl control, Graphics graphics, System.Drawing.Text.HotkeyPrefix hotkeyPrefix) { Control = control; Graphics = graphics; DefaultFont = control.LabelFont ?? control.Font; HotkeyPrefix = hotkeyPrefix; if (control.FocusStyle != null && control.FocusStyle.IsPainted) this.FocusStyle = control.FocusStyle; if (control.LabelTextColor.IsEmpty) LabelTextColor = control.ForeColor; else LabelTextColor = control.LabelTextColor; LabelTextBrush = new SolidBrush(LabelTextColor); TextAlignment = control.LabelTextAlignment; } public LayoutControl Control = null; public Graphics Graphics = null; public Font DefaultFont = null; public System.Drawing.Text.HotkeyPrefix HotkeyPrefix = System.Drawing.Text.HotkeyPrefix.Show; public SimpleStyle FocusStyle = null; public Color LabelTextColor = Color.Empty; public Brush LabelTextBrush = null; public eTextAlignment TextAlignment = eTextAlignment.Default; #region IDisposable Members public void Dispose() { if (LabelTextBrush != null) { LabelTextBrush.Dispose(); LabelTextBrush = null; } } #endregion } }