public VisualStudioFormChrome() { Buttons = new VisualStudioButtonCollection(this); _formChrome = new FormChrome { CaptionHeight = 31, ResizeBorderThickness = new Padding(0), DoubleBuffered = true }; _formChrome.NonClientAreaPaint += _formChrome_NonClientAreaPaint; _formChrome.NonClientMouseDown += _formChrome_NonClientMouseDown; _formChrome.NonClientMouseUp += _formChrome_NonClientMouseUp; _formChrome.NonClientMouseLeave += _formChrome_NonClientMouseLeave; _formChrome.NonClientMouseMove += _formChrome_NonClientMouseMove; _formChrome.SystemCommand += _formChrome_SystemCommand; _blackImageCache = new ImageCache(Color.Black); _whiteImageCache = new ImageCache(Color.White); _grayImageCache = new ImageCache(SystemColors.ControlDark); PrimaryColor = Color.FromArgb(0, 122, 204); BorderColor = Color.FromArgb(0, 122, 204); }
protected override void Dispose(bool disposing) { if (!_disposed && disposing) { if (_borderImageCacheManager != null) { _borderImageCacheManager.Dispose(); _borderImageCacheManager = null; } if (_primaryImageCacheManager != null) { _primaryImageCacheManager.Dispose(); _primaryImageCacheManager = null; } if (_formChrome != null) { _formChrome.Dispose(); _formChrome = null; } if (_dropShadowManager != null) { _dropShadowManager.Dispose(); _dropShadowManager = null; } if (_blackImageCache != null) { _blackImageCache.Dispose(); _blackImageCache = null; } if (_whiteImageCache != null) { _whiteImageCache.Dispose(); _whiteImageCache = null; } if (_grayImageCache != null) { _grayImageCache.Dispose(); _grayImageCache = null; } if (_primaryColorBrush != null) { _primaryColorBrush.Dispose(); _primaryColorBrush = null; } _disposed = true; } base.Dispose(disposing); }
public ChromeManager(Form form, FormChrome chrome) { if (form == null) { throw new ArgumentNullException("form"); } if (chrome == null) { throw new ArgumentNullException("chrome"); } _form = form; _chrome = chrome; }
public ChromeManager(Form form, FormChrome chrome) { if (form == null) throw new ArgumentNullException("form"); if (chrome == null) throw new ArgumentNullException("chrome"); _form = form; _chrome = chrome; if (form.IsHandleCreated) { AssignHandle(form.Handle); InitializeForm(); } else { form.HandleCreated += form_HandleCreated; } form.HandleDestroyed += form_HandleDestroyed; }