Example #1
0
        /// <summary>Draws the text title.</summary>
        /// <param name="graphics">The specified graphics to draw on.</param>
        private void DrawTitle(Graphics graphics)
        {
            try
            {
                Size _textSize = GraphicsManager.MeasureTextRenderer(Text, Font);

                // Fixes: Lower hanging characters like 'g'.
                _textSize.Height = _textSize.Height + 1;

                Point _titleLocation;

                switch (_titleAlignment)
                {
                case Alignment.TextAlignment.Center:
                {
                    _titleLocation = new Point((Width / 2) - (_textSize.Width / 2), _textRectangle.Y);
                    break;
                }

                case Alignment.TextAlignment.Left:
                {
                    _titleLocation = new Point(_vsImage.Point.X + _vsImage.Size.Width + 1, _textRectangle.Y);
                    break;
                }

                case Alignment.TextAlignment.Right:
                {
                    _titleLocation = new Point(Width - _border.Thickness - _textSize.Width - _visualControlBox.Width - 1, _textRectangle.Y);
                    break;
                }

                default:
                {
                    throw new ArgumentOutOfRangeException();
                }
                }

                _textRectangle = new Rectangle(_titleLocation.X, _titleLocation.Y, _textSize.Width, _textSize.Height);
                graphics.DrawString(Text, Font, new SolidBrush(ForeColor), _textRectangle);
            }
            catch (Exception e)
            {
                VisualExceptionDialog.Show(e);
            }
        }
        /// <summary>Display the <see cref="VisualExceptionDialog" />.</summary>
        /// <param name="exception">The exception.</param>
        /// <param name="caption">The caption.</param>
        /// <param name="dialogWindow">The dialog Window.</param>
        /// <returns>The <see cref="DoWorkEventHandler" />.</returns>
        private static DoWorkEventHandler BackgroundWorker_DoShowWork(Exception exception, string caption, bool dialogWindow)
        {
            VisualExceptionDialog _exceptionDialog = new VisualExceptionDialog(exception)
            {
                Text = caption
            };

            if (dialogWindow)
            {
                _exceptionDialog.ShowDialog();
            }
            else
            {
                _exceptionDialog.Show();
            }

            return(null);
        }
Example #3
0
        public void UpdateTheme(Theme theme)
        {
            try
            {
                _styleManager = new StyleManager(theme);

                _background        = theme.OtherSettings.FormBackground;
                _border.Color      = theme.BorderSettings.Normal;
                _border.HoverColor = theme.BorderSettings.Hover;
                ForeColor          = theme.TextSetting.Enabled;
                Font            = theme.TextSetting.Font;
                _windowBarColor = theme.OtherSettings.FormWindowBar;
            }
            catch (Exception e)
            {
                VisualExceptionDialog.Show(e);
            }

            OnThemeChanged(new ThemeEventArgs(theme));
        }