예제 #1
0
        public static void ScaleDpi(this BorderedPanel panel, Func <Bitmap, Bitmap> iconScaler)
        {
            panel.ScaleDpiSize();

            new DpiScaler <BorderedPanel, Bitmap>(
                c => (Bitmap)c.BackgroundImage,
                (c, bmp) => c.BackgroundImage = bmp,
                iconScaler).Setup(panel);
        }
예제 #2
0
        [UsedImplicitly]         // by ninject
        public TooltipForm()
        {
            _panel = new BorderedPanel
            {
                Dock = DockStyle.Fill
            };

            Controls.Add(_panel);

            var font = new Font(FontFamily.GenericSansSerif, 9.75f, FontStyle.Regular, GraphicsUnit.Point);

            _tooltipTextbox = new FixedRichTextBox
            {
                Dock              = DockStyle.Fill,
                ReadOnly          = true,
                TabStop           = false,
                ScrollBars        = RichTextBoxScrollBars.None,
                WordWrap          = true,
                BorderStyle       = BorderStyle.None,
                HideSelection     = true,
                Font              = font,
                AutoWordSelection = false
            };

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

            _panel.Controls.Add(_tooltipTextbox);

            _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;

            ColorSchemeController.SystemColorsChanging += systemColorsChanging;

            BackColor = SystemColors.Window;

            setupIcons();
        }
예제 #3
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();
        }
예제 #4
0
 private static void scalePanelIcon(BorderedPanel panel)
 {
     panel.ScaleDpi();
     panel.BackgroundImage = ((Bitmap)panel.BackgroundImage).HalfResizeDpi();
 }
예제 #5
0
        public TooltipForm()
        {
            BackColor       = Color.White;
            FormBorderStyle = FormBorderStyle.None;

            _tooltipSize        = new Size(400, 300).ByDpi();
            _closeIcon          = Properties.Resources.close_tab_hovered_32.HalfResizeDpi();
            _selectableTextIcon = Properties.Resources.selectable_transp_64.HalfResizeDpi();

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

            _panel = new BorderedPanel
            {
                BorderColor = BorderColor,
                BackColor   = BackColor,
                Dock        = DockStyle.Fill
            };

            Controls.Add(_panel);

            _tooltipTextbox = new FixedRichTextBox
            {
                Anchor            = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top,
                ReadOnly          = true,
                TabStop           = false,
                ScrollBars        = RichTextBoxScrollBars.None,
                WordWrap          = true,
                Size              = new Size(Width - TextPadding * 2, Height - TextPadding * 2),
                Location          = new Point(TextPadding, TextPadding),
                Margin            = new Padding(TextPadding),
                BackColor         = BackColor,
                BorderStyle       = BorderStyle.None,
                HideSelection     = true,
                Font              = new Font(new FontFamily("Tahoma"), 9.75f, FontStyle.Regular, GraphicsUnit.Point),
                AutoWordSelection = false
            };

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

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

            _panel.Controls.Add(_tooltipTextbox);

            _selectionSubsystem = new RichTextBoxSelectionSubsystem(_tooltipTextbox);
            _selectionSubsystem.SubscribeToEvents();

            _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 would lead to an exception
                    BorderColor        = Color.FromArgb(0,255, 255, 255)
                }
            };

            _buttonClose.Click += closeClick;

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

            setCloseEnabled(false);

            Resize += resize;

            Show();
        }