void EDSToolTip_Draw(object sender, DrawToolTipEventArgs e) { if (e.ToolTipText.Trim() != "") { //e.DrawBackground(); Graphics g = e.Graphics; //draw background LinearGradientBrush lgb = new LinearGradientBrush(new Rectangle(Point.Empty, e.Bounds.Size), Color.FromArgb(250, 252, 253), Color.FromArgb(206, 220, 240), LinearGradientMode.Vertical); g.FillRectangle(lgb, new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height)); lgb.Dispose(); //Console.WriteLine(e.ToolTipText); //draw border ControlPaint.DrawBorder(g, e.Bounds, SystemColors.GrayText, ButtonBorderStyle.Dashed); //draw Image g.DrawImage(image, new Point(5, 5)); // Draw the custom text. // The using block will dispose the StringFormat automatically. using (StringFormat sf = new StringFormat()) { using (Font f = new Font("Tahoma", 8)) { e.Graphics.DrawString(e.ToolTipText, f, Brushes.Black, e.Bounds.X + 25, e.Bounds.Y + 30, StringFormat.GenericTypographic); } } } }
static void ToolTip2_Draw(object sender, DrawToolTipEventArgs e) { Debug.Assert(BidiHelper.IsRightToLeft, "Tooltip2 should only be ownerdraw when running RTL"); e.DrawBackground(); e.DrawBorder(); e.DrawText(TextFormatFlags.PreserveGraphicsClipping | TextFormatFlags.RightToLeft | TextFormatFlags.Right); }
// Handles drawing the ToolTip. private void toolTip_Draw(System.Object sender, System.Windows.Forms.DrawToolTipEventArgs e) { // Draw the ToolTip differently depending on which // control this ToolTip is for. // Draw a custom 3D border if the ToolTip is for button1. //if (e.AssociatedControl == fpPictureBox1) { // Draw the standard background. e.DrawBackground(); // 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) }); // Specify custom text formatting flags. TextFormatFlags sf = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter | TextFormatFlags.NoFullWidthCharacterBreak; // Draw the standard text with customized formatting options. e.DrawText(sf); } }
private void ToolTip_Draw(object sender, DrawToolTipEventArgs e) { using (var brush = new SolidBrush(Color.Orange)) { e.Graphics.FillRectangle(brush, e.Bounds); } using (var brush = new SolidBrush(ForeColor)) { e.Graphics.DrawString(e.ToolTipText, _font, brush, 0, 0); } }
private static void toolTip_Draw(object sender, DrawToolTipEventArgs e) { ToolTip t = (ToolTip)sender; t.BackColor = tooltipBgColor; e.DrawBackground(); e.DrawBorder(); e.Graphics.DrawString(e.ToolTipText, tooltipFont, tooltipFgColor, new PointF(1, 1)); }
private void iterationsToolTip_Draw(object sender, System.Windows.Forms.DrawToolTipEventArgs e) { Font f = new Font("Arial", 16.0f); e.DrawBackground(); e.DrawBorder(); e.Graphics.DrawString(e.ToolTipText, f, Brushes.White, new PointF(2, 2)); }
private void OnToolTipDraw(object sender, DrawToolTipEventArgs e) { e.Graphics.Clear(Color.White); if (_container != null) { //Draw HTML! _container.PerformPaint(e.Graphics); } }
void HtmlToolTip_Draw(object sender, DrawToolTipEventArgs e) { e.Graphics.Clear(Color.White); if (container != null) { //Draw HTML! container.Paint(e.Graphics); } }
private void MobToolTip_Draw( object sender, DrawToolTipEventArgs e ) { if( mBackgroundBrush == null ) mBackgroundBrush = new SolidBrush( BackColor ); if( mBorderPen == null ) mBorderPen = new Pen( Color.Black, 2 ); Size size = new Size( e.Bounds.Width, e.Bounds.Height ); e.Graphics.FillRectangle( mBackgroundBrush, 0, 0, size.Width, size.Height ); e.Graphics.DrawRectangle( mBorderPen, 0, 0, size.Width, size.Height ); DrawMobInfo( e.Graphics, e.Font, true ); }
void RichToolTip_Draw(object sender, DrawToolTipEventArgs e) { e.Graphics.Clear(Color.White); using (Image image = new Bitmap(toolTipSize.Width, toolTipSize.Height)) { using (Graphics g = Graphics.FromImage(image)) { RtbPCtrl.Print(0, RtbPCtrl.Text.Length, g, new Rectangle(RtbPCtrl.Location, toolTipSize)); } e.Graphics.DrawImageUnscaled(image, e.Bounds); } }
private void ColorToolTip_Draw(object sender, DrawToolTipEventArgs e) { if (mBackgroundBrush == null) { mBackgroundBrush = (SolidBrush)GetBrush(BackColor); } if (mBorderPen == null) { mBorderPen = GetPen(Color.Black, 2); } Size size = new Size(e.Bounds.Width, e.Bounds.Height); e.Graphics.FillRectangle(mBackgroundBrush, 0, 0, size.Width, size.Height); e.Graphics.DrawRectangle(mBorderPen, 0, 0, size.Width, size.Height); DrawTooltip(e.Graphics, false); }
void OnDrawEvent(object sender, DrawToolTipEventArgs e) { // Draw the background and border. //e.DrawBackground(); e.DrawBorder(); StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Near; sf.LineAlignment = StringAlignment.Center; int Margin = 5; int image_wid = 2 * Margin + 100; Rectangle rect = new Rectangle(image_wid, 0, e.Bounds.Width - image_wid, e.Bounds.Height); e.Graphics.DrawString(e.ToolTipText, e.Font, Brushes.Green, rect, sf); }
private void OnDraw(object sender, DrawToolTipEventArgs e) { Rectangle bounds = e.Bounds; bounds.Offset(TOOLTIP_XOFFSET, TOOLTIP_YOFFSET); var br = new SolidBrush(this.ForeColor); var fontsize = e.AssociatedControl.FindForm().Font.Size; var font = new Font(SystemFonts.DefaultFont.FontFamily, fontsize); e.DrawBackground(); e.DrawBorder(); e.Graphics.DrawString(e.ToolTipText, font, br, TOOLTIP_XOFFSET, TOOLTIP_YOFFSET); br.Dispose(); font.Dispose(); }
private void NotesTip_Draw(object sender, DrawToolTipEventArgs e) { // ******************************************************************* if (Application.RenderWithVisualStyles) { VisualStyleRenderer renderer = new VisualStyleRenderer(VisualStyleElement.ToolTip.Standard.Normal); renderer.DrawBackground(e.Graphics, e.Bounds); } else { e.Graphics.FillRectangle(SystemBrushes.Info, e.Bounds); e.Graphics.DrawRectangle(SystemPens.WindowFrame, new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Height - 1)); } // ****************************************************************** // Draw something }
private void description_Draw(object sender, DrawToolTipEventArgs e) { Graphics g = e.Graphics; LinearGradientBrush b = new LinearGradientBrush(e.Bounds, Color.BurlyWood, Color.Gray, 45f); g.FillRectangle(b, e.Bounds); g.DrawRectangle(new Pen(Brushes.Black, 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)); g.DrawString(e.ToolTipText, new Font(e.Font, FontStyle.Bold), Brushes.Black, new PointF(e.Bounds.X + 5, e.Bounds.Y + 5)); b.Dispose(); }
private void ToolTip_Draw(object sender, System.Windows.Forms.DrawToolTipEventArgs e) { e.DrawBackground(); using (var pen = new System.Drawing.Pen( System.Drawing.Color.FromArgb(255, ColorOutline.R, ColorOutline.G, ColorOutline.B), OutlineThickness)) { e.Graphics.DrawRectangle(pen, new System.Drawing.Rectangle(e.Bounds.X + (OutlineThickness - 1), e.Bounds.Y + (OutlineThickness - 1), e.Bounds.Width - OutlineThickness, e.Bounds.Height - OutlineThickness)); } e.Graphics.DrawString(Title, TooltipTitleFont, System.Drawing.Brushes.White, TextPadding, TextPadding); if (!string.IsNullOrWhiteSpace(Text)) { e.Graphics.DrawString(Text, TooltipFont, System.Drawing.Brushes.White, TextPadding, TextPadding + titleSize.Height + PaddingBetweenTitleAndText); } }
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; } } }
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 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); }
private void changeButtonToolTip_Draw(object sender, DrawToolTipEventArgs e) { e.DrawBackground(); e.DrawBorder(); e.Graphics.DrawString(e.ToolTipText, changeButtonFont, Brushes.Black, new PointF(0, 0)); }
private void variableHover_Draw(object sender, DrawToolTipEventArgs e) { using (Font fw = new Font(FontFamily.GenericMonospace, ToolTipFontSize)) { var g = e.Graphics; DrawToolTipEventArgs args = new DrawToolTipEventArgs(g, e.AssociatedWindow, e.AssociatedControl, e.Bounds, e.ToolTipText, variableHover.BackColor, variableHover.ForeColor, fw); args.DrawBackground(); args.DrawBorder(); args.DrawText(TextFormatFlags.TextBoxControl); } }
/// <summary> /// CustomizedToolTip_Draw raised when tooltip is drawn. /// </summary> /// <param name="sender">sender</param> /// <param name="e">e</param> void ToolTip_Draw(object sender, DrawToolTipEventArgs e) { try { e.Graphics.CompositingQuality = CompositingQuality.HighQuality; //Get the tooltip text string TipText = base.GetToolTip(e.AssociatedControl); RibbonToolTipRenderEventArgs eTip = new RibbonToolTipRenderEventArgs(Owner, e.Graphics, e.Bounds, TipText); eTip.Color = Color.Black; eTip.Font = _Font; Owner.Renderer.OnRenderToolTipBackground(eTip); //e.DrawBackground(); StringFormat sf = new StringFormat(); sf.Trimming = StringTrimming.None; eTip.Format = sf; //draw the image if (_ImageRectangle.Width > 0 && _ImageRectangle.Height > 0) { //_Owner.Renderer.OnRenderToolTipImage(eTip); e.Graphics.DrawImage(_ToolTipImage, _ImageRectangle); } //draw the tooltip text if (_TextRectangle.Width > 0 && _TextRectangle.Height > 0) { sf.Alignment = StringAlignment.Near; sf.LineAlignment = StringAlignment.Near; eTip.ClipRectangle = _TextRectangle; eTip.Text = TipText; Owner.Renderer.OnRenderToolTipText(eTip); } // Draw the Title if (_TitleRectangle.Width > 0 && _TitleRectangle.Height > 0) { Font f = new Font(_Font, FontStyle.Bold); eTip.ClipRectangle = _TitleRectangle; eTip.Text = ToolTipTitle; eTip.Font = f; Owner.Renderer.OnRenderToolTipText(eTip); f.Dispose(); } } catch (Exception ex) { string logMessage = "Exception in RibbonToolTip_Draw (object, DrawToolTipEventArgs) " + ex.ToString(); Trace.TraceError(logMessage); throw; } }
/// <summary> /// Draw the html using the tooltip graphics. /// </summary> protected virtual void OnToolTipDraw(DrawToolTipEventArgs e) { #if !MONO if (_tooltipHandle == IntPtr.Zero) { // get the handle of the tooltip window using the graphics device context var hdc = e.Graphics.GetHdc(); _tooltipHandle = Win32Utils.WindowFromDC(hdc); e.Graphics.ReleaseHdc(hdc); AdjustTooltipPosition(e.AssociatedControl, e.Bounds.Size); } #endif e.Graphics.Clear(Color.White); e.Graphics.TextRenderingHint = _textRenderingHint; HtmlContainer.PerformPaint(e.Graphics); }
/// <summary> /// Draws background, border, text, and the image of tooltip /// </summary> /// <param name="sender">object</param> /// <param name="e">DrawToolTipEventArgs</param> private void toolTipSLMIV_Draw(object sender, DrawToolTipEventArgs e) { try { TreeView tview = (TreeView)e.AssociatedWindow; if (tview.SelectedNode != null) { TreeNode tnode = tview.SelectedNode; //Create SLMIVImage which reads the ImageLog SLMIVImage NodeImage = new SLMIVImage(Common.ImageLog); NodeImage.Get(tnode.Name); //Draw the background and border e.DrawBackground(); e.DrawBorder(); //Draw the text StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Center; Rectangle rect = new Rectangle(125, 0, e.Bounds.Width - (150), e.Bounds.Height); e.Graphics.DrawString(tnode.Text, e.Font, Brushes.Black, rect, sf); if ((((string)tnode.Tag) != "notecard") && (((string)tnode.Tag) != "lsl")) { //Draw the image e.Graphics.DrawImage(NodeImage.Get(tnode.Name), 9, 9); } else { //Does it have a local text file? if (NodeImage.path_image != null && NodeImage.path_image.ToLower().Trim().EndsWith(".txt")) { System.Drawing.Image image = new Bitmap(SLMIV.Resources.Folder_open, 120, 120); e.Graphics.DrawImage(image, 9, 9); } else if (NodeImage.path_image != null && NodeImage.path_image.ToLower().Trim().EndsWith(".lsl")) { System.Drawing.Image image = new Bitmap(SLMIV.Resources.Folder_open, 120, 120); e.Graphics.DrawImage(image, 9, 9); //Draw the no image //e.Graphics.DrawImage(System.Drawing.Image.FromHbitmap(SLMIV.Resources.Nonecircle.GetHbitmap()), 9, 9); } else { //Draw the no image System.Drawing.Image image = new Bitmap(SLMIV.Resources.Nonecircle, 120, 120); e.Graphics.DrawImage(image, 9, 9); } } } } catch (Exception ex) { } }
/// <summary> /// The on draw. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> private void OnDraw(object sender, DrawToolTipEventArgs e) { e.DrawBorder(); e.DrawBackground(); using (var brush = new SolidBrush(this.ForeColor)) { e.Graphics.DrawString(e.ToolTipText, this.Font, brush, e.Bounds.X + this.Padding.Left, e.Bounds.Y + this.Padding.Top); } }
/* �Զ���ToolTip�ػ溯�����Խ��Win7�±���ɫ�������õ����� */ void tt_Draw(object sender, DrawToolTipEventArgs e) { ToolTip tempTT = (ToolTip)sender; using (Brush backBrush = new SolidBrush(tempTT.BackColor)) { e.Graphics.FillRectangle(backBrush, e.Bounds); e.DrawBorder(); } using (Brush textBrush = new SolidBrush(tempTT.ForeColor)) { StringFormat sf = new StringFormat(); //sf.Alignment = StringAlignment.Center; //sf.LineAlignment = StringAlignment.Center; sf.FormatFlags = StringFormatFlags.NoWrap; sf.Trimming = StringTrimming.None; e.Graphics.DrawString(e.ToolTipText, e.Font, textBrush, e.Bounds, sf); } }
// Handles drawing the ToolTip. private void toolTip1_Draw(System.Object sender, System.Windows.Forms.DrawToolTipEventArgs e) { // Draw the ToolTip differently depending on which // control this ToolTip is for. // Draw a custom 3D border if the ToolTip is for button1. if (e.AssociatedControl == button1) { // Draw the standard background. e.DrawBackground(); // 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) }); // Specify custom text formatting flags. TextFormatFlags sf = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter | TextFormatFlags.NoFullWidthCharacterBreak; // Draw the standard text with customized formatting options. e.DrawText(sf); } // Draw a custom background and text if the ToolTip is for button2. else if (e.AssociatedControl == button2) { // Draw the custom background. e.Graphics.FillRectangle(SystemBrushes.ActiveCaption, e.Bounds); // Draw the standard border. e.DrawBorder(); // Draw the custom text. // The using block will dispose the StringFormat automatically. using (StringFormat sf = new StringFormat()) { 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)) { e.Graphics.DrawString(e.ToolTipText, f, SystemBrushes.ActiveCaptionText, e.Bounds, sf); } } } // Draw the ToolTip using default values if the ToolTip is for button3. else if (e.AssociatedControl == button3) { e.DrawBackground(); e.DrawBorder(); e.DrawText(); } }
private void tooltip_window_Draw (object sender, DrawToolTipEventArgs e) { if (OwnerDraw) OnDraw (e); //else // ThemeEngine.Current.DrawToolTip (e.Graphics, e.Bounds, tooltip_window); }
private void toolTip1_Draw(object sender, DrawToolTipEventArgs e) { //e.Graphics.FillRectangle(new SolidBrush(Color.SteelBlue), e.Bounds); e.DrawBackground(); e.DrawBorder(); TextRenderer.DrawText(e.Graphics, "red", e.Font, e.Bounds, Color.Red); // e.DrawText(); }
//user drawn event handler for toolTip private void toolTipHint_Draw(object sender, DrawToolTipEventArgs e) { e.DrawBackground(); e.DrawBorder(); e.DrawText(); }
private void OnDraw(object sender, DrawToolTipEventArgs e) // use this event to customise the tool tip { // Set our background Graphics g = e.Graphics; var n = BackgroundImage.Clone() as Bitmap; var rectSz = e.Bounds.Size; n = ResizeBitmap(n, rectSz.Width, rectSz.Height); g.Clear(Color.FromArgb(50, 50, 50)); g.DrawImage(n, 0, 0); e.DrawBorder(); // Draw our ToolTip title var rectF = new RectangleF(new PointF(8, TitleFont.Height + 10), new Size(tSize.Width - 8, tSize.Height)); if (MaxWidth != 0) { g.DrawString(ToolTipDescription, DescriptionFont, DescriptionBrush, rectF); } else { g.DrawString(ToolTipDescription, DescriptionFont, DescriptionBrush, rectF.Location); }; g.DrawString((Prefix + this.ToolTipTitle + Suffix).Trim('\n'), TitleFont, TitleBrush, new PointF(6, 4)); }
private void OnToolTipDraw(object sender, DrawToolTipEventArgs e) { OnToolTipDraw(e); }
/// ------------------------------------------------------------------------------------ /// <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); } }
internal void OnDraw (DrawToolTipEventArgs e) { DrawToolTipEventHandler eh = (DrawToolTipEventHandler)(Events[DrawEvent]); if (eh != null) eh (this, e); }
private void tp_Draw(object sender, System.Windows.Forms.DrawToolTipEventArgs e) { e.DrawBackground(); e.DrawBorder(); e.DrawText(); }