protected internal virtual void OnNonClientAreaPaint(NonClientPaintEventArgs e) { var ev = NonClientAreaPaint; if (ev != null) { ev(this, e); } }
protected internal virtual void OnNonClientAreaPaint(NonClientPaintEventArgs e) { var ev = NonClientAreaPaint; if (ev != null) ev(this, e); }
void _formChrome_NonClientAreaPaint(object sender, NonClientPaintEventArgs e) { var border = _formChrome.AdjustedResizeBorderThickness; if (border != _lastBorder) { _lastBorder = border; _dropShadowManager.Synchronize(); } UpdateBorderColor(); e.Graphics.Clear(SystemColors.Control); var state = new ButtonStates(this); if (state.Close.Draw) { DrawButton(e.Graphics, state.Close, e.IsMaximized); } if (state.MaximizeRestore.Draw) { DrawButton(e.Graphics, state.MaximizeRestore, e.IsMaximized); } if (state.Minimize.Draw) { DrawButton(e.Graphics, state.Minimize, e.IsMaximized); } foreach (var extraButton in state.ExtraButtons) { DrawButton(e.Graphics, extraButton); } int leftOffset = IconOffset.X + border.Left; if (state.DrawIcon) { e.Graphics.DrawImage( GetFormIcon(), leftOffset, IconOffset.Y + border.Top ); leftOffset += IconSize.Width; } leftOffset += TextOffset.X; var textBounds = new Rectangle( leftOffset, TextOffset.Y + border.Top, state.RightOffset - leftOffset, int.MaxValue ); TextRenderer.DrawText( e.Graphics, Form.Text, SystemFonts.MessageBoxFont, textBounds, SystemColors.ControlDarkDark, SystemColors.Control, TextFormatFlags.NoPrefix | TextFormatFlags.SingleLine | TextFormatFlags.EndEllipsis ); }
void _formChrome_NonClientAreaPaint(object sender, NonClientPaintEventArgs e) { var border = _formChrome.AdjustedResizeBorderThickness; if (border != _lastBorder) { _lastBorder = border; _dropShadowManager.Synchronize(); } UpdateBorderColor(); e.Graphics.Clear(SystemColors.Control); var state = new ButtonStates(this); if (state.Close.Draw) DrawButton(e.Graphics, state.Close, e.IsMaximized); if (state.MaximizeRestore.Draw) DrawButton(e.Graphics, state.MaximizeRestore, e.IsMaximized); if (state.Minimize.Draw) DrawButton(e.Graphics, state.Minimize, e.IsMaximized); foreach (var extraButton in state.ExtraButtons) { DrawButton(e.Graphics, extraButton); } int leftOffset = IconOffset.X + border.Left; if (state.DrawIcon) { e.Graphics.DrawImage( GetFormIcon(), leftOffset, IconOffset.Y + border.Top ); leftOffset += IconSize.Width; } leftOffset += TextOffset.X; var textBounds = new Rectangle( leftOffset, TextOffset.Y + border.Top, state.RightOffset - leftOffset, int.MaxValue ); TextRenderer.DrawText( e.Graphics, Form.Text, SystemFonts.MessageBoxFont, textBounds, SystemColors.ControlDarkDark, SystemColors.Control, TextFormatFlags.NoPrefix | TextFormatFlags.SingleLine | TextFormatFlags.EndEllipsis ); }