Exemple #1
0
        [UsedImplicitly]         // by ninject
        public TooltipForm(EnableShadow enableShadow)
            : base(enableShadow)
        {
            FormBorderStyle = FormBorderStyle.None;

            ControlBox    = false;
            ShowInTaskbar = false;
            StartPosition = FormStartPosition.Manual;
            Location      = new Point(-10000, -10000);
            TopMost       = true;

            KeyPreview = false;

            _panel = new BorderedPanel
            {
                Dock = DockStyle.Fill
            };

            Controls.Add(_panel);

            _tooltipTextbox = new FixedRichTextBox
            {
                Dock              = DockStyle.Fill,
                ReadOnly          = true,
                TabStop           = false,
                ScrollBars        = RichTextBoxScrollBars.None,
                WordWrap          = true,
                BorderStyle       = BorderStyle.None,
                HideSelection     = true,
                Font              = new Font(new FontFamily("Tahoma"), 9.75f, FontStyle.Regular, GraphicsUnit.Point),
                AutoWordSelection = false
            };

            TextPadding = new Padding(6, 3, 6, 3);

            _panel.Controls.Add(_tooltipTextbox);

            _tooltipFocusTarget = new Control
            {
                Size     = new Size(1, 1),
                Location = new Point(-1, -1)
            };

            _panel.Controls.Add(_tooltipFocusTarget);

            _buttonClose = new Button
            {
                TabStop = false,
                Anchor  = AnchorStyles.Right | AnchorStyles.Top,

                FlatStyle      = FlatStyle.Flat,
                FlatAppearance =
                {
                    BorderSize         =                 0,
                    MouseOverBackColor = Color.Transparent,
                    MouseDownBackColor = Color.Transparent,
                    CheckedBackColor   = Color.Transparent,
                    // setting Color.Transparent leads to an exception
                    BorderColor        = Color.FromArgb(0,255, 255, 255)
                }
            };

            _panel.Controls.Add(_buttonClose);
            _buttonClose.BringToFront();

            _tooltipTextbox.MouseDown  += text_MouseDown;
            _tooltipTextbox.MouseClick += text_MouseClick;

            _tooltipTextbox.KeyDown   += text_keyDown;
            _tooltipTextbox.LostFocus += text_lostFocus;

            _buttonClose.Click += closeClick;

            Resize += resize;
            ColorSchemeController.SystemColorsChanging += systemColorsChanging;

            BackColor = SystemColors.Window;

            setupIcons();
        }
Exemple #2
0
 public ShadowedForm(EnableShadow enableShadow)
 {
     EnableShadow = enableShadow == Mtgdb.Controls.EnableShadow.Yes;
 }