Exemple #1
0
        public static HintForm Show(Form parent, string hint)
        {
            var form = new HintForm
            {
                Size            = new Size(30, 30),
                TopMost         = true,
                FormBorderStyle = FormBorderStyle.None,
                StartPosition   = FormStartPosition.Manual,
                BackColor       = Color.Black,
                Opacity         = 0.85
            };
            var label = new Label()
            {
                Text        = hint,
                TextAlign   = ContentAlignment.MiddleCenter,
                Dock        = DockStyle.Fill,
                ForeColor   = Color.White,
                BorderStyle = BorderStyle.FixedSingle,
                Visible     = true
            };

            form.Controls.Add(label);

            form.MinimumSize = new Size(label.PreferredWidth + 20, form.Height);
            form.MaximumSize = form.MinimumSize;

            form.Location = new Point(parent.Left + parent.Width / 2 - form.Width / 2, parent.Top + parent.Height / 2 - form.Height / 2);
            form.Show(parent);

            Application.DoEvents();

            return(form);
        }
Exemple #2
0
        private void ShowDetailForm(AggregateLogItem item)
        {
            const int FORM_Y_OFFSET = 5;

            if (_detailForm == null)
            {
                using (var hint = HintForm.Show(this, "Initializing Editor ..."))
                {
                    _detailForm = new ItemDetailForm();
                    hint.Close();
                }
            }

            _detailForm.Bounds = new Rectangle(
                this.Left + ((this.Width - _detailForm.Width) / 2),
                this.Top + FORM_Y_OFFSET,
                Math.Max(_detailForm.Width, this.Width / 2),
                this.Height - FORM_Y_OFFSET * 2);

            _detailForm.Item          = item;
            _detailForm.ItemNavigator = this;

            _detailForm.ShowDialog(this);
        }