Exemple #1
0
        void OnDraw(object sender, DrawToolTipEventArgs e)
        {
            int      y        = 0;
            Graphics graphics = e.Graphics;

            graphics.FillRectangle(new SolidBrush(BackColor), e.Bounds);
            graphics.DrawRectangle(new Pen(Color.FromArgb(75, 75, 75)), new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Height - 1));
            graphics.DrawString(lines[y], Font, new SolidBrush(WoWHelper.QalityColor(Item.Quality)), new PointF(3, 1 + 14 * y++));
            if (Item.MaxCount == 1)
            {
                graphics.DrawString(lines[y], Font, new SolidBrush(ForeColor), new PointF(3, 1 + 14 * y++));
            }
            graphics.DrawString(lines[y], Font, new SolidBrush(ForeColor), new PointF(3, 1 + 14 * y++));
            List <string> classes = WoWHelper.Classes(Item.AllowableClass);

            if (classes.Count < 9)
            {
                DrawClasses(lines[y].Split(' '), y, graphics);
            }
        }
Exemple #2
0
 protected override void OnPaint(DrawToolTipEventArgs e)
 {
     if (_textEntries != null)
     {
         var gx   = e.Graphics;
         var font = e.Font;
         var y    = VerticalMargin;
         foreach (var entry in _textEntries)
         {
             var x = HorizontalMargin;
             if (entry.Image != null)
             {
                 gx.DrawImage(entry.Image, x, y + (entry.Image.Height - _rowHeight) / 2);
                 x += entry.Image.Width + 3;
             }
             GitterApplication.TextRenderer.DrawText(
                 gx, entry.Text, font, SystemBrushes.InfoText, x, y, StringFormat.GenericTypographic);
             y += _rowHeight + VerticalSpacing;
         }
     }
 }
Exemple #3
0
        private void ttCopy_Draw(object sender, DrawToolTipEventArgs e)
        {
            // Draw the custom background.
            e.Graphics.FillRectangle(new SolidBrush(Color.Black), e.Bounds);

            // Draw the custom text.
            // The using block will dispose the StringFormat automatically.
            using (StringFormat sf = new StringFormat())
            {
                sf.FormatFlags   = StringFormatFlags.NoClip | StringFormatFlags.NoFontFallback;
                sf.Alignment     = StringAlignment.Center;
                sf.LineAlignment = StringAlignment.Center;
                sf.HotkeyPrefix  = System.Drawing.Text.HotkeyPrefix.None;
                sf.FormatFlags   = StringFormatFlags.NoWrap;
                using (Font f = new Font("Tahoma", 9, FontStyle.Bold))
                {
                    e.Graphics.DrawString(e.ToolTipText, f,
                                          new SolidBrush(Color.White), e.Bounds, sf);
                }
            }
        }
        private void OnDraw(object sender, DrawToolTipEventArgs e)
        {
            Graphics g = e.Graphics;

            g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;

            // Body Color
            g.FillRectangle(new SolidBrush(BackColor), e.Bounds);

            // Message
            g.DrawString(e.ToolTipText, new Font(Font.FontFamily, 9.75f, Font.Style),
                         new SolidBrush(ForeColor), e.Bounds, new StringFormat()
            {
                Alignment     = StringAlignment.Center,
                LineAlignment = StringAlignment.Center
            });

            // 1px Border
            g.DrawRectangle(new Pen(new SolidBrush(ForeColor), 1), new Rectangle(
                                e.Bounds.X, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Height - 1));
        }
Exemple #5
0
        private void toolTip4_Draw(object sender, DrawToolTipEventArgs e)
        {
            // Draw the background and border
            e.DrawBackground();
            e.DrawBorder();

            // Prikaz slike
            e.Graphics.DrawImage(Properties.Resources.GustinaRaspodeleFormula, 10, 10);

            // Ispis teksta pored slike
            using (StringFormat sf = new StringFormat())
            {
                sf.Alignment     = StringAlignment.Near;
                sf.LineAlignment = StringAlignment.Center;

                int sirinaSlike = 2 * 10 + Properties.Resources.GustinaRaspodeleFormula.Width;

                Rectangle rect = new Rectangle(sirinaSlike, 0, e.Bounds.Width - sirinaSlike, e.Bounds.Height);
                e.Graphics.DrawString(e.ToolTipText, e.Font, Brushes.Black, rect, sf);
            }
        }
Exemple #6
0
        private void MetroToolTip_Draw(object sender, DrawToolTipEventArgs e)
        {
            MetroThemeStyle displayTheme = (Theme == MetroThemeStyle.Light) ? MetroThemeStyle.Dark : MetroThemeStyle.Light;

            Color backColor   = MetroPaint.BackColor.Form(displayTheme);
            Color borderColor = MetroPaint.BorderColor.Button.Normal(displayTheme);
            Color foreColor   = MetroPaint.ForeColor.Label.Normal(displayTheme);

            using (SolidBrush b = new SolidBrush(backColor))
            {
                e.Graphics.FillRectangle(b, e.Bounds);
            }
            using (Pen p = new Pen(borderColor))
            {
                e.Graphics.DrawRectangle(p, new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Height - 1));
            }

            Font f = MetroFonts.Default(13f);

            TextRenderer.DrawText(e.Graphics, e.ToolTipText, f, e.Bounds, foreColor, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter);
        }
Exemple #7
0
        void CustomizedToolTip_Draw(object sender, DrawToolTipEventArgs e)
        {
            e.Graphics.CompositingQuality = CompositingQuality.HighQuality;
            Rectangle myToolTipRectangle = new Rectangle();

            myToolTipRectangle.Size = e.Bounds.Size;
            e.Graphics.FillRectangle(myBorderBrush, myToolTipRectangle);
            Rectangle myImageRectangle = Rectangle.Inflate(myToolTipRectangle,
                                                           -BORDER_THICKNESS, -BORDER_THICKNESS);

            e.Graphics.FillRectangle(myBackColorBrush, myImageRectangle);
            Control parent       = e.AssociatedControl;
            Image   toolTipImage = FImage;

            if (FImage != null)
            {
                myImageRectangle.Width  = FImage.Width;
                myImageRectangle.Height = FImage.Height;
                e.Graphics.DrawImage(toolTipImage, myImageRectangle);
            }
        }
Exemple #8
0
        /// <summary>
        ///     CustomizedToolTip_Draw raised when tooltip is drawn.
        /// </summary>
        /// <param name="sender">sender</param>
        /// <param name="e">e</param>
        private void CustomizedToolTip_Draw(object sender, DrawToolTipEventArgs e)
        {
            try
            {
                e.Graphics.CompositingQuality = CompositingQuality.HighQuality;

                myToolTipRectangle.Size = e.Bounds.Size;
                e.Graphics.FillRectangle(myBorderBrush, myToolTipRectangle);

                myImageRectangle = Rectangle.Inflate(myToolTipRectangle, -BORDER_THICKNESS, -BORDER_THICKNESS);
                e.Graphics.FillRectangle(myBackColorBrush, myImageRectangle);

                Control parent       = e.AssociatedControl;
                var     toolTipImage = parent.Tag as Image;
                if (toolTipImage != null)
                {
                    myImageRectangle.Width = myInternalImageWidth;
                    myTextRectangle        = new Rectangle(myImageRectangle.Right, myImageRectangle.Top,
                                                           (myToolTipRectangle.Width - myImageRectangle.Right -
                                                            BORDER_THICKNESS), myImageRectangle.Height);
                    myTextRectangle.Location = new Point(myImageRectangle.Right, myImageRectangle.Top);

                    e.Graphics.FillRectangle(myBackColorBrush, myTextRectangle);
                    e.Graphics.DrawImage(toolTipImage, myImageRectangle);
                    e.Graphics.DrawString(e.ToolTipText, myFont, myTextBrush, myTextRectangle, myTextFormat);
                }
                else
                {
                    e.Graphics.DrawString(e.ToolTipText, myFont, myTextBrush, myImageRectangle, myTextFormat);
                }
            }

            catch (Exception ex)
            {
                string logMessage =
                    "Exception in CustomizedToolTip.BlindHeaderToolTip_Draw (object, DrawToolTipEventArgs) " + ex;
                Trace.TraceError(logMessage);
                throw;
            }
        }
        void OPMToolTip_Draw(object sender, DrawToolTipEventArgs e)
        {
            if (e.AssociatedControl != null && _data.ContainsKey(e.AssociatedControl))
            {
                e.Graphics.CompositingMode    = CompositingMode.SourceOver;
                e.Graphics.CompositingQuality = CompositingQuality.HighQuality;
                e.Graphics.InterpolationMode  = InterpolationMode.HighQualityBicubic;
                e.Graphics.SmoothingMode      = SmoothingMode.AntiAlias;
                e.Graphics.TextRenderingHint  = TextRenderingHint.ClearTypeGridFit;
                e.Graphics.TextContrast       = 5;

                //e.DrawBackground();
                //e.DrawBorder();

                using (LinearGradientBrush b = new LinearGradientBrush(e.Bounds,
                                                                       ControlPaint.Light(ThemeManager.GradientNormalColor1),
                                                                       ControlPaint.Light(ThemeManager.GradientNormalColor2), 90))
                {
                    e.Graphics.FillRectangle(b, e.Bounds);
                }

                using (Pen p = new Pen(ThemeManager.BorderColor))
                {
                    Rectangle rc = new Rectangle(e.Bounds.Location,
                                                 new Size(e.Bounds.Width - 1, e.Bounds.Height - 1));

                    e.Graphics.DrawRectangle(p, rc);
                }

                DrawContents(e.Graphics, _data[e.AssociatedControl]);
            }
            else
            {
                // Fallback to regular tooltip
                e.DrawBorder();
                e.DrawBackground();
                e.DrawText();
            }
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Handles the draw.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        void HandleDraw(object sender, DrawToolTipEventArgs e)
        {
            e.DrawBackground();
            e.DrawBorder();

            Form            frm   = m_ctrl.FindForm();
            TextFormatFlags flags = (frm.RightToLeft == RightToLeft.Yes ?
                                     TextFormatFlags.RightToLeft : TextFormatFlags.Left) |
                                    TextFormatFlags.VerticalCenter;

            TextRenderer.DrawText(e.Graphics, ToolTipTitle, m_fntTitle,
                                  m_rcTitle, SystemColors.InfoText, flags);

            TextRenderer.DrawText(e.Graphics, m_text, m_fntText, m_rcText,
                                  SystemColors.InfoText, flags);

            // Draw the icon
            if (m_showMissingGlyphIcon)
            {
                Point pt = m_rcTitle.Location;
                pt.X -= (m_missingGlyphIcon.Width + 5);
                if (m_missingGlyphIcon.Height > m_rcTitle.Height)
                {
                    pt.Y -= (int)((m_missingGlyphIcon.Height - m_rcTitle.Height) / 2);
                }

                e.Graphics.DrawImageUnscaled(m_missingGlyphIcon, pt);
            }

            // Draw a line separating the title from the text below it.
            Point pt1 = new Point(e.Bounds.X + 7, m_rcTitle.Bottom + 7);
            Point pt2 = new Point(e.Bounds.Right - 5, m_rcTitle.Bottom + 7);

            using (LinearGradientBrush br = new LinearGradientBrush(pt1, pt2,
                                                                    SystemColors.InfoText, SystemColors.Info))
            {
                e.Graphics.DrawLine(new Pen(br, 1), pt1, pt2);
            }
        }
        /// <summary>
        /// ModernToolTipDraw method.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">A System.EventArgs that contains the event data.</param>
        private void ModernToolTipDraw(object sender, DrawToolTipEventArgs e)
        {
            ModernThemeStyle displayTheme = this.ThemeStyle == ModernThemeStyle.Light ? ModernThemeStyle.Dark : ModernThemeStyle.Light;

            Color backColor   = ModernPaint.BackColor.Form(displayTheme);
            Color borderColor = ModernPaint.BorderColor.Button.Normal(displayTheme);
            Color foreColor   = ModernPaint.ForeColor.Label.Normal(displayTheme);

            using (SolidBrush brush = new SolidBrush(backColor))
            {
                e.Graphics.FillRectangle(brush, e.Bounds);
            }

            using (Pen pen = new Pen(borderColor))
            {
                e.Graphics.DrawRectangle(pen, new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Height - 1));
            }

            Font font = ModernFonts.GetDefaultFont(13f, ModernFontWeight.Regular);

            TextRenderer.DrawText(e.Graphics, e.ToolTipText, font, e.Bounds, foreColor, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter);
        }
Exemple #12
0
        private void descriptionToolTips_Draw(object sender, DrawToolTipEventArgs e)
        {
            e.DrawBackground();
            Rectangle rect = e.Bounds;
            Bitmap    bmp  = new Bitmap(ResourceLoadHelper.GetBlankImage(new Size(rect.Width, rect.Height), descriptionToolTips.BackColor));

            foreach (Component c in descriptionToolTips.Container.Components)
            {
                if (c is CoinsBar)
                {
                    CoinsBar cb = c as CoinsBar;
                    if (cb.Visible)
                    {
                        rect = cb.Bounds;
                        cb.DrawToBitmap(bmp, rect);
                        e.Graphics.DrawImage(bmp, rect, rect, GraphicsUnit.Pixel);
                        e.Graphics.DrawString(string.Format("x{0}", _drawnCoins[(CoinType)cb.CoinValue]), new Font("Microsoft Sans Serif", 7, FontStyle.Italic), new SolidBrush(Color.Black), rect.Right, rect.Bottom - 14);
                    }
                }
            }
            e.DrawBorder();
        }
Exemple #13
0
        private void OnDraw(object sender, DrawToolTipEventArgs e)
        {
            if (this.CurrentUser != null)
            {
                using (LinearGradientBrush brush = new LinearGradientBrush(e.Bounds, Color.WhiteSmoke, Color.Silver, LinearGradientMode.Vertical))
                    e.Graphics.FillRectangle(brush, e.Bounds);

                if (this.CurrentUser.AvatarBytes.Length > 0)
                {
                    using (MemoryStream ms = new MemoryStream(this.CurrentUser.AvatarBytes))
                        using (Bitmap bmp = new Bitmap(ms))
                            e.Graphics.DrawImage(bmp, new Rectangle(5, 5, 80, 80));
                }
                else
                {
                    using (MemoryStream ms = new MemoryStream(Avatar.DefaultAvatar))
                        using (Bitmap bmp = new Bitmap(ms))
                            e.Graphics.DrawImage(bmp, new Rectangle(5, 5, 80, 80));
                }

                this.DrawString(this.CurrentUser.Name, e.Graphics);
            }
        }
Exemple #14
0
        private void MToolTip_Draw(object sender, DrawToolTipEventArgs e)
        {
            e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            //e.DrawBackground();

            using (var brush = new SolidBrush(this.BackColor))
            {
                e.Graphics.FillRectangle(brush, e.Bounds);
            }

            using (var pen = new Pen(this.BorderColor, this.BorderWidth))
            {
                e.Graphics.DrawRectangle(pen, e.Bounds);
            }
            //e.DrawBorder();

            var fontSize = e.Graphics.MeasureString(e.ToolTipText, e.Font);

            using (var brush = new SolidBrush(this.ForeColor))
            {
                e.Graphics.DrawString(e.ToolTipText, e.Font, brush, BorderWidth * 2, (e.Bounds.Height - fontSize.Height) / 2);
            }
        }
        /// <summary>
        /// Drawing of the tooltip.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnDraw(object sender, DrawToolTipEventArgs e)
        {
            Graphics g = e.Graphics;

            // to set the tag for each button or object
            Control parent = e.AssociatedControl;

            if (parent.Tag != null)
            {
                Image image = parent.Tag as Image;

                if (image != null)
                {
                    //create image brush.
                    TextureBrush b = new TextureBrush(new Bitmap(image, e.Bounds.Size));// get the image from Tag

                    g.FillRectangle(b, e.Bounds);
                    b.Dispose();
                }
            }

            g.Dispose();
        }
Exemple #16
0
        /// <summary>
        /// Draw customized Tooltip
        /// </summary>
        /// <param name="sender">Current Object</param>
        /// <param name="e">Draw Tooltip Event handler</param>
        private void DrawToolTip(object sender, DrawToolTipEventArgs e)
        {
            // Draw the custom background.
            e.Graphics.FillRectangle(_bshBackGround, e.Bounds);

            // Draw the custom border to appear 3-dimensional.
            //Draw Left Line And Top Line
            e.Graphics.DrawLines(_penBorder, new Point[] {
                new Point(0, e.Bounds.Height - 1),
                new Point(0, 0),
                new Point(e.Bounds.Width - 1, 0)
            });

            //Draw Bottom Line and Right Line
            e.Graphics.DrawLines(_penBorder, new Point[] {
                new Point(0, e.Bounds.Height - 1),
                new Point(e.Bounds.Width - 1, e.Bounds.Height - 1),
                new Point(e.Bounds.Width - 1, 0)
            });

            // Draw the custom text.
            e.Graphics.DrawString(e.ToolTipText, _font, _bshText, e.Bounds, _strFormat);
        }
Exemple #17
0
        private void ToolTip_Draw(Object sender, DrawToolTipEventArgs e)
        {
            if (fToolTipText == null || fToolTipText.Count == 0)
            {
                return;
            }

            var gfx = e.Graphics;

            gfx.FillRectangle(Brushes.AntiqueWhite, e.Bounds);
            e.DrawBorder();

            int titleHeight = 14;
            int fontHeight  = 12;

            // Draws the line just below the title
            gfx.DrawLine(Pens.Black, 0, titleHeight, e.Bounds.Width, titleHeight);

            // Draws the title
            string title = fToolTipText[0];

            using (Font font = new Font(e.Font, FontStyle.Bold)) {
                int x = (int)(e.Bounds.Width - gfx.MeasureString(title, font).Width) / 2;
                int y = (int)(titleHeight - gfx.MeasureString(title, font).Height) / 2;
                gfx.DrawString(title, font, Brushes.Black, x, y);
            }

            // Draws the lines
            for (int line = 1; line < fToolTipText.Count; line++)
            {
                string str = fToolTipText[line];

                int x = 5;
                int y = (int)(titleHeight - fontHeight - gfx.MeasureString(str, e.Font).Height) / 2 + 10 + (line * 14);
                gfx.DrawString(str, e.Font, Brushes.Black, x, y);
            }
        }
        public void tooltip_Draw(object sender, DrawToolTipEventArgs e)
        {
            String           assetId          = m_dataSource.Text;
            AssetInformation assetInformation = Database.Database.getAsset(assetId);

            if (assetInformation != null)
            {
                // Draw the standard background.
                //e.DrawBackground();

                // Draw the standard background
                //e.DrawBorder();

                Image image = Search.FrmAsset.getImage(assetInformation.filename,
                                                       assetInformation.base_id.ToString(),
                                                       assetInformation.descr,
                                                       out assetInformation.filename);
                if (image != null)
                {
                    e.Graphics.DrawImage(image, 0, 0);
                }

                /*
                 * // Draw the custom border to appear 3-dimensional.
                 * e.Graphics.DrawLines(SystemPens.ControlLightLight, new Point[] {
                 *  new Point (0, e.Bounds.Height - 1),
                 *  new Point (0, 0),
                 *  new Point (e.Bounds.Width - 1, 0)
                 * });
                 * e.Graphics.DrawLines(SystemPens.ControlDarkDark, new Point[] {
                 *  new Point (0, e.Bounds.Height - 1),
                 *  new Point (e.Bounds.Width - 1, e.Bounds.Height - 1),
                 *  new Point (e.Bounds.Width - 1, 0)
                 * });
                 */
            }
        }
        private void OnDraw(object sender, DrawToolTipEventArgs e) // use this event to customise the tool tip
        {
            Graphics g = e.Graphics;


            //LinearGradientBrush b = new LinearGradientBrush(e.Bounds,
            //    Color.GreenYellow, Color.MintCream, 45f);

            g.FillRectangle(BackgroundBrush, e.Bounds);

            g.DrawRectangle(ForegroundPen, new Rectangle(e.Bounds.X, e.Bounds.Y,
                                                         e.Bounds.Width - 1, e.Bounds.Height - 1));

            int lineheight = GetLineHeight(g, e.AssociatedControl.Font);

            int posy = 0;
            int idx  = 0;

            foreach (string nstring in DataSource)
            {
                //if (idx == Position)
                //{
                //    g.FillRectangle(BackgroundBrushHightLight, new Rectangle(0, posy, e.Bounds.Width, lineheight));
                //    g.DrawString(nstring, e.AssociatedControl.Font, ForegroundBrushHightlight, new Point(0, posy));
                //}
                //else
                g.DrawString(nstring, e.AssociatedControl.Font, ForegroundBrush, new Point(0, posy));
                posy = posy + lineheight;
                idx++;
            }


            //g.DrawString(e.ToolTipText, new Font(e.Font, FontStyle.Bold), Brushes.Silver,
            //    new PointF(e.Bounds.X + 6, e.Bounds.Y + 6)); // shadow layer
            //g.DrawString(e.ToolTipText, new Font(e.Font, FontStyle.Bold), Brushes.Black,
            //    new PointF(e.Bounds.X + 5, e.Bounds.Y + 5)); // top layer
        }
Exemple #20
0
        public static void DrawMessage(DrawToolTipEventArgs e)
        {
            LinearGradientBrush gradientDefault = new LinearGradientBrush(e.Bounds,
                                                                          Color.White, Color.Lavender,
                                                                          LinearGradientMode.Vertical);

            // Draw the custom background
            e.Graphics.FillRectangle(gradientDefault, e.Bounds);

            // Draw the custom border to appear 3-dimensional
            e.Graphics.DrawLines(new Pen(Color.Gray), new Point[] {
                new Point(0, e.Bounds.Height - 1),
                new Point(e.Bounds.Width - 1, e.Bounds.Height - 1),
                new Point(e.Bounds.Width - 1, 0)
            });
            e.Graphics.DrawLines(new Pen(Color.DarkGray), new Point[] {
                new Point(0, e.Bounds.Height - 1),
                new Point(0, 0),
                new Point(e.Bounds.Width - 1, 0)
            });

            // Draw the standard text with customized formatting options
            e.DrawText(sff);
        }
Exemple #21
0
        private void OnDraw(object sender, DrawToolTipEventArgs e) // use this event to customise the tool tip
        {
            Graphics g = e.Graphics;


            //creating gradiant color for background
            LinearGradientBrush b = new LinearGradientBrush(e.Bounds,
                                                            Color.GreenYellow, Color.OrangeRed, 45f);

            g.FillRectangle(b, e.Bounds);

            g.DrawRectangle(new Pen(Brushes.Red, 1), new Rectangle(e.Bounds.X, e.Bounds.Y,
                                                                   e.Bounds.Width - 1, e.Bounds.Height - 1));

            g.DrawString(e.ToolTipText, new Font(e.Font, FontStyle.Bold), Brushes.Silver,
                         new PointF(e.Bounds.X + 6, e.Bounds.Y + 6)); // shadow layer
            // e.ToolTipSize = TextRenderer.MeasureText(toolTipText, new Font("Courier New", 10.0f, FontStyle.Bold));


            g.DrawString(e.ToolTipText, new Font(e.Font, FontStyle.Bold), Brushes.Black,
                         new PointF(e.Bounds.X + 5, e.Bounds.Y + 5)); // top layer

            b.Dispose();
        }
Exemple #22
0
        private void toolTip1_Draw(object sender, DrawToolTipEventArgs e)
        {
            Color c = Color.Lime;;  //Color.Maroon

            switch (tabControl1.SelectedIndex)
            {
            case 0: c = Color.Crimson; break;

            case 1: c = Color.Goldenrod; break;

            case 2: c = Color.DeepSkyBlue; break;

            case 3: c = Color.LightSeaGreen; break;

            default: break;
            }

            switch ((string)e.AssociatedControl.Parent.Tag)
            {
            case "1": toolTip1.BackColor = Color.FromArgb(21, 9, 9); break;

            case "2": toolTip1.BackColor = Color.FromArgb(16, 12, 38); break;

            case "3": toolTip1.BackColor = Color.FromArgb(47, 13, 26); break;

            default: break;
            }

            e.DrawBackground();
            //e.DrawBorder();
            Pen pen = new Pen(c, 3);

            e.Graphics.DrawLines(pen, new Point[] { new Point(0, e.Bounds.Height + 1), new Point(0, 0), new Point(e.Bounds.Width + 1, 0) });
            e.Graphics.DrawLines(pen, new Point[] { new Point(0, e.Bounds.Height - 1), new Point(e.Bounds.Width - 1, e.Bounds.Height - 1), new Point(e.Bounds.Width - 1, 0) });
            e.Graphics.DrawString(e.ToolTipText, f, Brushes.AntiqueWhite, e.Bounds);
        }
Exemple #23
0
        void XPToolTip_Draw(object sender, DrawToolTipEventArgs e)
        {
            e.Graphics.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.None;
            e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;

            int tX = 3;
            int tY = 4;

            int totalWidth  = Convert.ToInt32(e.Graphics.MeasureString(e.ToolTipText, new Font("Tahoma", 8.25f)).Width) + 7;
            int totalHeight = Convert.ToInt32(e.Graphics.MeasureString(e.ToolTipText, new Font("Tahoma", 8.25f)).Height) + 8;



            var bFill = new SolidBrush(Color.FromArgb(255, 255, 225));

            e.Graphics.FillRectangle(bFill, 1, 1, totalWidth - 2, totalHeight - 2);

            Pen pBorder = new Pen(Color.Black);


            e.Graphics.DrawRectangle(pBorder, 0, 0, totalWidth, totalHeight);

            e.Graphics.DrawString(e.ToolTipText, new Font("Tahoma", 8.25f), Brushes.Black, tX, tY);
        }
        private void TooltipReminderNote_Draw(object sender, DrawToolTipEventArgs e)
        {
            Graphics   g = e.Graphics;
            SolidBrush b;

            if (MaterialSkin.MaterialSkinManager.Instance.Theme == MaterialSkin.MaterialSkinManager.Themes.DARK)
            {
                b = new SolidBrush(BACKGROUND_DARK);

                g.FillRectangle(b, e.Bounds);

                TextRenderer.DrawText(e.Graphics, e.ToolTipText, new Font(pfc.Families[0], 13f, FontStyle.Regular, GraphicsUnit.Pixel), new Point(e.Bounds.X + 5, e.Bounds.Y + 5), TEXT_HIGH_EMPHASIS_LIGHT);
            }
            else
            {
                b = new SolidBrush(BACKGROUND_LIGHT);

                g.FillRectangle(b, e.Bounds);

                TextRenderer.DrawText(e.Graphics, e.ToolTipText, new Font(pfc.Families[0], 13f, FontStyle.Regular, GraphicsUnit.Pixel), new Point(e.Bounds.X + 5, e.Bounds.Y + 5), TEXT_HIGH_EMPHASIS_DARK);
            }
            g.Dispose();
            b.Dispose();
        }
Exemple #25
0
        private void OnDraw(object sender, DrawToolTipEventArgs e)
        {
            e.DrawBackground();

            e.DrawBorder();

            // カスタムテキストの描画

#if false
            using (var sf = new StringFormat())
            {
                sf.Alignment     = StringAlignment.Near;
                sf.LineAlignment = StringAlignment.Center;
                sf.HotkeyPrefix  = System.Drawing.Text.HotkeyPrefix.None;
                sf.FormatFlags   = StringFormatFlags.NoWrap;

                //var rect = new Rectangle(Point.Empty, this.Size);

                // e.Fontは元のフォント。使っては駄目。
                e.Graphics.DrawString(e.ToolTipText, Font, SystemBrushes.ActiveCaptionText, /*rect*/
                                      e.Bounds, sf);

                // → paddingするか、DrawText()を用いるかしないとはみ出る。なんぞこれ…。
                //    DrawString()用のサイズではないということか…。
                // cf.
                // Custom OwnerDraw ToolTip size issue
                // https://stackoverflow.com/questions/49199417/custom-ownerdraw-tooltip-size-issue
            }
#endif

            var flags = TextFormatFlags.LeftAndRightPadding | TextFormatFlags.VerticalCenter;
            TextRenderer.DrawText(e.Graphics, e.ToolTipText, Font, e.Bounds,
                                  ForeColor, Color.Empty,
                                  flags     /*TextFormatFlags.Default*/
                                  );
        }
Exemple #26
0
        private void MetroToolTip_Draw(object sender, DrawToolTipEventArgs e)
        {
            MetroThemeStyle metroThemeStyle = (this.Theme == MetroThemeStyle.Light ? MetroThemeStyle.Dark : MetroThemeStyle.Light);
            Color           color           = MetroPaint.BackColor.Form(metroThemeStyle);
            Color           color1          = MetroPaint.BorderColor.Button.Normal(metroThemeStyle);
            Color           color2          = MetroPaint.ForeColor.Label.Normal(metroThemeStyle);

            using (SolidBrush solidBrush = new SolidBrush(color))
            {
                e.Graphics.FillRectangle(solidBrush, e.Bounds);
            }
            using (Pen pen = new Pen(color1))
            {
                Graphics  graphics  = e.Graphics;
                int       x         = e.Bounds.X;
                int       y         = e.Bounds.Y;
                Rectangle bounds    = e.Bounds;
                Rectangle rectangle = e.Bounds;
                graphics.DrawRectangle(pen, new Rectangle(x, y, bounds.Width - 1, rectangle.Height - 1));
            }
            Font font = MetroFonts.Default(13f);

            TextRenderer.DrawText(e.Graphics, e.ToolTipText, font, e.Bounds, color2, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter);
        }
Exemple #27
0
        public static void DrawInfo(DrawToolTipEventArgs e)
        {
            LinearGradientBrush gradientInfo = new LinearGradientBrush(e.Bounds,
                                                                       ColorTheme.TipGradient.Color,
                                                                       ColorTheme.TipGradient.BackgroundColor,
                                                                       LinearGradientMode.Vertical);

            // Draw the custom background
            e.Graphics.FillRectangle(gradientInfo, e.Bounds);

            if (ColorTheme.IsDarkTheme)
            {
                Rectangle border = new Rectangle(e.Bounds.Location, new Size(e.Bounds.Width - 1, e.Bounds.Height - 1));
                e.Graphics.DrawRectangle(new Pen(ColorTheme.TipBorderFrame), border);

                Point locationText = e.Bounds.Location;
                locationText.Offset(3, 1);
                e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
                Font font;
                if (e.Font.Size > 11.5f)
                {
                    font = new Font(e.Font.FontFamily, 11.5f, FontStyle.Regular, GraphicsUnit.Pixel);
                }
                else
                {
                    font = e.Font;
                }
                e.Graphics.DrawString(e.ToolTipText, font, ColorTheme.TipText, locationText, sf);
            }
            else
            {
                e.DrawBorder();
                // Draw the standard text with customized formatting options
                e.DrawText(sff);
            }
        }
Exemple #28
0
        private void OnDraw(object sender, DrawToolTipEventArgs e) // use this event to customise the tool tip
        {
            System.Drawing.Font f = new System.Drawing.Font("Calibri", 10.0f);

            Graphics g          = e.Graphics;
            Color    myRgbColor = new Color();

            myRgbColor = Color.FromArgb(255, 47, 49, 46);
            LinearGradientBrush b = new LinearGradientBrush(e.Bounds,
                                                            myRgbColor, myRgbColor, 45f);

            g.FillRectangle(b, e.Bounds);

            //Pen myPen = new Pen(Brushes.Red, 1);
            //myPen.LineJoin = System.Drawing.Drawing2D.LineJoin.Round;

            // g.DrawRectangle(myPen, new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Height - 1));

            //g.DrawString(e.ToolTipText, new Font(e.Font, FontStyle.Bold), Brushes.Black,
            //    new PointF(e.Bounds.X + 6, e.Bounds.Y + 6)); // shadow layer

            g.DrawString(e.ToolTipText, f, Brushes.White,
                         new PointF(e.Bounds.X + 10, e.Bounds.Y + 10)); // top layer



            //var t = (ToolTip)sender;
            //var h = t.GetType().GetProperty("Handle",
            //  System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
            //var handle = (IntPtr)h.GetValue(t);
            //var c = e.AssociatedControl;
            //var location = c.Parent.PointToScreen(new Point(c.Right - e.Bounds.Width, c.Bottom));
            //MoveWindow(handle, location.X, location.Y, e.Bounds.Width, e.Bounds.Height, false);

            //b.Dispose();
        }
Exemple #29
0
 void Paint(object sender, DrawToolTipEventArgs e)
 {
     e.DrawBackground();
     e.DrawText();
 }
 private static void ToolTip_Draw(object sender, DrawToolTipEventArgs e)
 {
     e.DrawBackground();
     e.DrawBorder();
     e.DrawText(TextFormatFlags.VerticalCenter | TextFormatFlags.LeftAndRightPadding);
 }
Exemple #31
0
 // Handles drawing the ToolTip.
 private void OnDrawStats(System.Object sender, DrawToolTipEventArgs e)
 {
     e.DrawBackground();
     e.DrawBorder();
     e.DrawText();
 }